It was a pain to google solutions for my problem since it is using application "at" :) So the thing is, I am trying to run long runnng operation (I know that I could add some specific entry to cron, but I am still learning new stuff") and I decided to use "at" application. The thing is that it does not run properly and as I believe it is because at runs applications as shell intead of bash by default.
echo "./home/user/test.sh" | at now
warning: commands will be executed using /bin/sh
job 5 at Sun Apr 17 12:34:00 2022
I've also tried suggestion from other tread that I've found on SOF and tried to create .bash script extensions for my script/s So my question is - how to make "at" run scripts as bash instead of shell?
1 .
2 .
However your problem might be simpler:
You must add
./before the name of a program/script run from a relative path, which protects you from accidentally running a program from a local directory. The dot represents the current directory and it literally tells your shell: "from current directory run this program".When you specify the absolute path to your executable, you do not prefix it with
./, because it is 1. invalid, as that executable is not in your current directory 2. needless, as by using the absolute path you already confirm that it is not a mistake and you know what you are doing.So this should be enough:
3 .
To state what shell (interpreter) should run your script, simply add a shebang as its first line:
Your script's extension does not matter, be it
.sh,.bashor even no extension at all.