[londonperl] Shell help needed

David Alban extasia at extasia.org
Thu Oct 11 14:32:00 BST 2007

On 10/11/07, David Cantrell <david at cantrell.org.uk> wrote:
> $ ssh -t some.random.host "screen -S foo /usr/local/bin/bash -c 'echo
>     $PATH;/usr/local/bin/bash'"
> $PATH here doesn't contain any of the customisations in my .profile or
> .bashrc.  And no combination of -i or -l when I invoke bash seems to do
> the job.  Help?

In your command above, the current shell is interpolating $PATH and
sending the remote shell the literal current path and not the literal
string '$PATH'.  This is because the single quotes enclosing $PATH are
themselves doubly quoted by the current shell, and thus, are not
metacharacters to the current shell.


  ssh -t some.random.host "echo '$PATH'"
  ssh -t some.random.host "echo \$PATH "

The first line of output will be the path of the current shell, and
will begin with 'FOO:BAR:BAT:'.  The second line of output will be the
path of the remote shell.

(Or did you want the remote shell to get the value of the current shell?)

Live in a world of your own, but always welcome visitors.

More information about the london.pm mailing list