0

I am trying to develop a shell script / bash script with ssh and screen, using Ubuntu / Linux. Could you help me to correct what is wrong here?

#!/bin/bash
ssh -i keypair.pem -t ubuntu@ec2-address "screen -S teste"; cd 'home'; cd 'Shell'; ./'AWS - teste.sh' "

It doesn't work.

1 Answer 1

1

You fell victim to shell quoting - which is tricky when using ssh. Your command does something alike

cd home/Shell; ./AWS - teste.sh

so I would try

ssh -i keypair.pem -t ubuntu@ec2-address screen -S teste "sh -c \"cd home/Shell; ./AWS - teste.sh\""
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.