I have /root/test.sh
on a remote server, which has the following content:
#!/bin/bash
date
On the remote server, I get the following output:
# ./test.sh
Fri Dec 18 07:41:10 EST 2015
# bash <(cat /root/test.sh)
Fri Dec 18 07:41:23 EST 2015
However, if I try to run the same commands from my local machine, I get the following result:
$ ssh root@remote_server /root/test.sh
Fri Dec 18 07:44:32 EST 2015
$ ssh root@remote_server bash <(cat /root/test.sh)
cat: /root/test.sh: No such file or directory
bash: /dev/fd/63: No such file or directory
So what's the problem of the last run? You might find it weird to run a script like this bash <(cat /root/test.sh)
. The reason I did it is because it is a simplified version of my real situation. My real code is to download a Bash script from the Internet and run it locally. I have a lot of machines to run, with different parameters, so I'm trying to run them from my local computer.
ssh root@remote_server /bin/cat test.sh
, for the simplified version. – Hastur Dec 18 '15 at 13:04