We will perform a migration from unix to Linux. the typeset -L only works with ksh
I created the following file:
#!/bin/ksh -u
echo $SHELL
typeset -L21 RUN_LOGL="LOG_FILE "
Normally the shebang should indicate the correct interpreter (ksh). But when I call the script in a bash way:
$ . test.ksh
The output is:
/bin/bash
-bash: typeset: -L: invalid option
typeset: usage: typeset [-aAfFilrtux] [-p] name[=value] ...
the script is interpreter in bash way , and typeset -L is not accepted. whereas if I simply call
$test.ksh
it runs fine.
Is the way we call the script (bash way or ksh way) important enough to ignore the shebang ?
Thank you in advance.
. test.ksh
Does not execute the script. It is sourcing the script.
Sourcing a script always ignores the shebang. The shebang is only used when the script is executed like:
chmod +x test.ksh
./test.ksh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With