TIMFOX123
asked on
is it valid to set the not in the first line of a script with #!
I am a very important and yet again mixed envirment.
each machine has one of "bash or ksh"
If there is bash I want to use it, otherwise I can use ksh. I never ever want to use "sh" because there are lines in my scripts that will not run with an oversimplistic shell
Here is my solution and I need to know if people forsee a a problem with selecting your shell after the script starts.
## set environment so you never get /bin/sh !!!
if [[ -e "/bin/bash" ]]; then
SHELL="/bin/bash"
else
SHELL="/bin/ksh"
fi
echo $SHELL
Oh, I am in a redhat, solaris, aix envirement with either bash OR ksh
each machine has one of "bash or ksh"
If there is bash I want to use it, otherwise I can use ksh. I never ever want to use "sh" because there are lines in my scripts that will not run with an oversimplistic shell
Here is my solution and I need to know if people forsee a a problem with selecting your shell after the script starts.
## set environment so you never get /bin/sh !!!
if [[ -e "/bin/bash" ]]; then
SHELL="/bin/bash"
else
SHELL="/bin/ksh"
fi
echo $SHELL
Oh, I am in a redhat, solaris, aix envirement with either bash OR ksh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please see your other question on this topic for an "inline" solution!
What user will be invoking the script?
If their login shell is either bash or ksh depending on the environment, then simply omit the #! line on the script/s and it will run under the shell of the user that is running the script.
If their login shell is either bash or ksh depending on the environment, then simply omit the #! line on the script/s and it will run under the shell of the user that is running the script.
ASKER
Sorry for me taking so long to get back. I work all the time and rarely get out to the "real internet "
thanks porky
thanks porky