Ben
Ben

Reputation: 125

how to write a shell script to run multiple commands

I want to run two commands

ssh -f [email protected] 'nohup Rscript L_1.R > L_1_sh.txt'

and

ssh -f [email protected] 'nohup Rscript L_2.R > L_2_sh.txt'

I write a shell script test_1.shas following:

ssh -f [email protected] 'nohup Rscript L_1.R > L_1_sh.txt' ; ssh -f [email protected] 'nohup Rscript L_2.R > L_2_sh.txt'

But it always run the first command. And it does not run the second command. The terminal shows

: command not found:

Upvotes: 0

Views: 1521

Answers (1)

Oldest Software Guy
Oldest Software Guy

Reputation: 741

ssh -f [email protected] 'nohup Rscript L_1.R > L_1_sh.txt' ; ssh -f [email protected] 'nohup Rscript L_2.R > L_2_sh.txt'

The error message is correct becaue there is no program named 'nohup -f mike...' on the destination system.

Run the test command:

ssh [email protected] echo 1 2 3

The [command] executed by ssh(1) can consist of multiple words, just not filename redirection; do that inside your script.

Upvotes: 1

Related Questions