I have several SAS programs


and I hope to nohup those scripts at once. I tried to create a shell wrapper such as a test.sh:

#test running multiple files
testing1_2.sas &
testing3_4.sas &

and I tried calling nohup sas test.sh & and nohup test.sh &. Both commands tell me test.sh is not in the current directory when it is clearly saved in the folder.

I am still quite new to shell scripting, and would like to have some help to find the right way for running nohup on multiple SAS programs. Thanks!

1 Answer 1


I'm not a big fan of nohup (I use disown instead), but if you put ‘nohup’ in front of each command in a shell script it will accomplish the nohup part of your question.

However, I think your files are SAS programs? If you want SAS run in parallel on each SAS program:

nohup sas test1_2.sas &
nohup sas test3_4.sas &

That will run independent SAS commands, each with it's own SAS program.

Continuing with the nohup command, if they produce output, they will all be writing to nohup.out at the same time. To prevent that, write output and error messages to a separate file for each command:

nohup sas test1_2.sas > output1_2.file 2>&1 &
nohup sas test3_4.sas > output3_4.file 2>&1 &

Added to include code from comments:

To invoke the test.sh command either

bash test.sh

(where “bash” is your favorite shell) or mark it as executable:

chmod +x test.sh

Since you're new, make sure and click on the checkmark if you think this is the right answer to your question.

  • 1
    Personally I would put the nohup's in the script and invoke the script without nohup.
    – Larry
    Apr 3, 2020 at 5:37
  • 1
    I anticipate another issue you may run into. When you invoke your test.sh shell script, you're either going to have to invoke it like this: bash test.sh (where “bash” is your favorite shell) or mark the script as executable: chmod +x test.sh
    – Larry
    Apr 3, 2020 at 5:38
  • 1
    Sorry, comments don't format the same as answers. I hope you understand what I typed. Let me know if you don't.
    – Larry
    Apr 3, 2020 at 5:40
  • 1
    You too! Make sure and accept the answer if it works the way you want.
    – Larry
    Apr 3, 2020 at 5:43
  • 1
    Oh, sure, that isn't a problem. Log is probably better.
    – Larry
    Apr 3, 2020 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .