ssh -p 60022 centos@localhost 'bash -s '< ./update.sh

If I run the following command through the terminal, all works fine and update.sh is ran on the remote machine.

If I place the same command into a bash script, deploy.sh for example, then execute with

. ./deploy.sh

from the same directory, it will not allow me to execute the script with the error:

: No such file or directory

I'm assuming this is something to do with working directories or something similar, but I can't find a fix.


The problem was line endings, when executing the file remotely with windows line endings nothing would work.

Changing the line endings to UNIX fixed this for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.