warning: commands will be executed using /bin/sh



  • Full Error: warning: commands will be executed using /bin/sh

    What was being executed at the time?

    $ at 07:38 < hw
    warning: commands will be executed using /bin/sh
    job 8 at Thu Nov 19 07:38:00 2020
    

    Contents of hw script.

    #!/bin/bash
    echo "Hello World!" > at.log
    ps -fp $$ >> at.log
    

    Resolution.

    This is default behavior of the at command. It will show no matter how you run the command.

           at and batch read commands from standard  input  or  a  specified  file
           which are to be executed at a later time, using /bin/sh.
    

    Add #!/bin/bash at the top of your script.

    If you need it to run as bash run the command like this:

    $ echo /home/trainer/scripts/hw | at 09:02
    

    Checking the output of the at execution in the log at.log, echo $$ shows the following

    Hello World!
    UID          PID    PPID  C STIME TTY          TIME CMD
    trainer    24720   24719  0 09:01 ?        00:00:00 /bin/bash /home/trainer/scripts/hw
    


© Lightnetics 2024