Closed hongkongkiwi closed 3 years ago
-P
explicitly disables putting arguments into the environment, including the script's name.
-S0
also disables putting arguments into the environment, but substitutes $0 in the script directly. What you want is:
#!/bin/execlineb -S0
backtick -E scriptdir { dirname $0 }
envfile /etc/s6/sv/${scriptdir}/conf
...
I've got some scripts which don't take any arguments (hence the -P), but I would like to know the name of the executing script which is normally set in 0 env. Also, -S0 is the same problem.
Here's my script:
But I found that when I use the -P tag, no variables (including 0) are defined. I would expect in either case, 0 to contain the name of the script even when no variables are being passed in.