Reputation: 177
I am attempting to remotely execute a Bash script defined as $CONST_FILE
while passing an option to it (in this case -u
). Unfortunately for me, the Bash Interpreter assigns my option to ssh instead my script; causing an error as ssh does not have a -u
option. The below section of code is causing a problem for me:
(ssh -o StrictHostKeyChecking=no -l $CONST_USERNAME $HOST_NAME_LOGIN<$CONST_FILE -u)
In previous Bash scripts, I have been able to execute Bash scripts via the above method so long as I was not passing an option with the script I was attempting to execute.
I have tried various placements of {} "" '' []
and other characters without success. What set of characters do I need in order for the Bash Interpreter to understand that -u
needs to be consumed by $CONST_FILE
instead of ssh?
Upvotes: 0
Views: 50
Reputation: 7235
The usual way is to use command like this:
ssh -o StrictHostKeyChecking=no -l $CONST_USERNAME $HOST_NAME_LOGIN "$CONST_FILE -u"
You can use also format like:
ssh -o StrictHostKeyChecking=no ${CONST_USERNAME}@${HOST_NAME_LOGIN} "$CONST_FILE -u"
Upvotes: 1