Script calls the script by ssh => bash: ...: no such file or directory

I am running a script that calls another script through an ssh connection.

My script executes the following command:

ssh $cluster "bash $create 2 2 $parts"

where $clusteris the ssh line, and $createis the absolute path of the bash script on the target machine. I run a ssh $cluster "mkdir $serialized/$number"few lines earlier, which works fine.

However, this command returns me:

bash: /data/.../create.bash 1 2 8: No such file or directory

The file is on the computer, and I can execute the command there, but I cannot figure out how to do this from a script on top of ssh. I tried another command, always get this exception.

Thank you for your help!

+3
source share
3 answers

, bash . , , bash, create.bash script , :

  #!/bin/bash

bash.

, :

  • bash , .

  • , bash, 'sh'.

+3

, script ? , :

ssh $cluster "bash '$create 2 2 $parts'"

.

( ,

bash: mumble: No such file or directory

mumble , , /data/.../create.bash 1 2 8, script .)

+1

Delete quotes:

ssh $cluster bash $create 2 2 $parts

or put them only around the arguments:

ssh $cluster bash "$create 2 2 $parts"

if your variable values ​​include spaces:

ssh $cluster bash "'$create' 2 2 '$parts'"
+1
source

Source: https://habr.com/ru/post/1796426/


All Articles