1
#!/bin/ksh

CTN=1
ssh -q user@host 'exec bash -s' << 'ENDSSH'
cd abc/def
./scriptname \$CTN
ENDSSH

exit;

However in the remote server, value of variable CTN is not getting passed. Please help.

1 Answer 1

3

It should be:

CTN=1
ssh -q user@host 'exec bash -s' << ENDSSH
cd abc/def
./scriptname "$CTN"
ENDSSH

Since you want $CTN to expanded locally you must not escape the $ and must not put ENDSSH between single quotes.

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.