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

Ralf Mardorf kde.lists at yahoo.com
Fri Nov 10 15:31:36 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

It only tells you that the at-command does use /bin/sh.
You can see against what shell sh does link by running

  ls -l /bin/sh

> and will it affect the script that is scheduled to run?
> The script has this shebang at the top:
> 
> #!/bin/bash

I don't know, just test it by running a script. The scripts below can be
used to do a test.

• rocketmouse at archlinux ~ 
$ cat shell_bash.sh
#!/bin/bash
lsof -p $$ | grep "/bin"
exit
• rocketmouse at archlinux ~ 
$ cat shell_dash.sh
#!/bin/dash
lsof -p $$ | grep "/bin"
exit

When _not_ using the at-command, it does return the shell that does run
the script on Arch Linux like this:

• rocketmouse at archlinux ~ 
$ ./shell_bash.sh
shell_bas 532714 rocketmouse  txt    REG  259,2  1112880 13114710 /usr/bin/bash
• rocketmouse at archlinux ~ 
$ ./shell_dash.sh 
shell_das 532737 rocketmouse  txt    REG  259,2   133792 13115846 /usr/bin/dash

I guess this should work when running the scripts by the at-command on Ubuntu, too.




More information about the ubuntu-users mailing list