I am have written a script which will silently installed Microstrategy on Amazon Linux 2.0
In My main script i am calling Microstrategy installation script which is in /bin/ksh and mine is in /bin/bash
mstr_install.sh is as follows:
#!/bin/bash
#DATE 22-FEB-2019
#DISCRIPTION: IT will Install MSTR-11.1 with Silent Options using optins.txt file
DATE=$(date +"%Y-%m-%d_%T")
PATH="/app/soft/Installations/QueryReportingAnalysis_Linux/"
/usr/bin/mv "$PATH"options.txt "$PATH"options_backup."$DATE"
/usr/bin/cp /app/automation/mstr/options.txt "$PATH"
/usr/bin/chmod 777 "$PATH"options.txt
cd "$PATH"
bash setup.sh -silent -options options.txt
exit
and setup.sh is vendor script which shebang line is
#/bin/ksh
I am running my script like below:
#sh -x mstr_install.sh
and getting the below errors:
[root@a1-m022mstiap01 mstr]# sh -x mstr_install.sh
++ date +%Y-%m-%d_%T
+ DATE=2019-07-25_07:59:35
+ PATH=/app/soft/Installations/QueryReportingAnalysis_Linux/
+ /usr/bin/mv /app/soft/Installations/QueryReportingAnalysis_Linux/options.txt /app/soft/Installations/QueryReportingAnalysis_Linux/options_backup.2019-07-25_07:59:35
+ /usr/bin/cp /app/automation/mstr/options.txt /app/soft/Installations/QueryReportingAnalysis_Linux/
+ /usr/bin/chmod 777 /app/soft/Installations/QueryReportingAnalysis_Linux/options.txt
+ cd /app/soft/Installations/QueryReportingAnalysis_Linux/
+ /usr/bin/ksh ./setup.sh -silent -options options.txt
./setup.sh[879]: basename: not found [No such file or directory]
./setup.sh[882]: dirname: not found [No such file or directory]
./setup.sh[883]: cd: bad directory
./setup.sh[408]: uname: not found [No such file or directory]
Checking for running instances..../setup.sh[866]: ps: not found [No such file or directory]
../setup.sh[82]: cat: not found [No such file or directory]
...done.
./setup.sh[466]: mkdir: not found [No such file or directory]
Unable to check the Kernel size
+ exit
[root@a1-m022mstiap01 mstr]#
It very wired issue let me know if anything missed to mention.
Thanks Santosh G.
This is wrong:
By using "bash" to start the script you skip the she-bang.
I would assume you need to do this:
(with the executable bit set) or
===
This is bad behaviour:
I would use a specific variable name for this that is not the same as an environment variable. Doing it like that will come back to bite you.