Reputation: 77
I am trying to run a .sh script on a remote server and am getting the following error message.
Really not sure what I am doing wrong.
The command I am using is: $ssh user@remoteserver path of file to be executed/Test.sh
Which returns the error: ksh: syntax error: `(' unexpected
Any pointers would be great :)
Upvotes: 0
Views: 5500
Reputation: 1006
If Machine A is a Windows box, you can use Plink (part of PuTTY) with the -m parameter, and it will execute the local script on the remote server.
plink root@MachineB -m local_script.sh
If Machine A is a Unix-based system, you can use:
ssh root@MachineB 'bash -s' < local_script.sh
You shouldn't have to copy the script to the remote server to run it.
Source: How to use SSH to run a shell script on a remote machine?
Upvotes: 2