When we print the console settings with the
echo $- command, we output
himBHs by default. However, when we run the same command in any script file, we only output
root@root:~# echo $- himBHs root@root:~# ./abc.sh hB root@root:~#
What I'm wondering is, even though we're running the script from a
/bin/bash environment, why don't the same default settings apply ?
For example, when I start a new sub-shell process with the command
/bin/bash on the console and list the settings, I get output
root@root:~# /bin/bash root@root:~# echo $- himBHs
When I try to perform the same process from within the shell file, the output I get is "hB".
root@root:~# ./abc.sh hB
I've tried the same process with shebang and without the shebang, but my script file is either
bash script_file or
./script_file if I run, it gives the same result(
What exactly am I missing?