At job warning "warning: commands will be executed using /bin/sh" what to do?

Karl Auer kauer at biplane.com.au
Fri Nov 10 23:41:02 UTC 2023


On Fri, 2023-11-10 at 15:59 +0100, Bo Berglund wrote:
> "warning: commands will be executed using /bin/sh"
> 
> Why is this happening and will it affect the script that is scheduled
> to run? The script has this shebang at the top:
> #!/bin/bash

I did a little test, with this script in "/home/kauer/testat.sh":

   #!/bin/bash
   echo "Shell is $SHELL" > /tmp/testat.txt

If the script is not marked executable, at emails me an error message:
"sh: 69: /home/kauer/testat.sh: Permission denied". The remaining tests
are run with the executable bit set on the script.

After setting the script to executable, the script runs and
/tmp/testat.txt contains "Shell is /bin/bash".

If I change the shebang to "#!/bin/sh" the script runs and
/tmp/testat.txt contains "Shell is ".

If I delete the shebang, the script runs and /tmp/testat.txt contains
"Shell is ".

If I replace the shebang with "#!/bin/flimbongle", at emails me an
error message: "sh: 69: /home/kauer/testat.sh: not found". 

So I would say the answer is that the shebang will be honoured if
present.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer






More information about the ubuntu-users mailing list