Executing command remotely with ssh, and PATH
Karl Auer
kauer at biplane.com.au
Thu Aug 9 13:59:04 UTC 2012
On Thu, 2012-08-09 at 14:42 +0100, Colin Law wrote:
> ssh remote_server "PATH=/some/path:$PATH; echo $PATH"
> Can anyone put me straight?
The variable is being expanded in the command, before the command is
being sent to the remote server. You need to escape any dollar signs
that are needed at the other end,
Here is a sequence showing the effect
kauer at karl:~$ unset FRED
kauer at karl:~$ echo $FRED
kauer at karl:~$ ssh localhost "FRED=blah ; echo $FRED"
kauer at karl:~$ ssh localhost "FRED=blah ; echo \$FRED"
blah
Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://www.biplane.com.au/blog
GPG fingerprint: AE1D 4868 6420 AD9A A698 5251 1699 7B78 4EEE 6017
Old fingerprint: DA41 51B1 1481 16E1 F7E2 B2E9 3007 14ED 5736 F687
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20120809/d84f82f6/attachment.sig>
More information about the ubuntu-users
mailing list