Georg Heiler
Georg Heiler

Reputation: 17676

How make pwd return remote personal working directory

pwd over ssh returns the local personal working directory. How can I easily access the remote pwd?

edit

I use ssh-agent forwarding 1x: local -> server1 -> server2 there I want to execute these scripts https://coreos.com/kubernetes/docs/latest/kubernetes-on-vagrant.html e.g. authority=${PWD}/ssl/ca.pem but instead of the remote working directory my local directory from the local computer is used.

Upvotes: 1

Views: 1277

Answers (1)

Jakuje
Jakuje

Reputation: 25966

If you run

ssh host echo $PWD

the $PWD variable is evaluated in your shell and not in the remote. If you want to evaluate the variable remote, you need tu escape the $ sign:

ssh host echo \$PWD

or put the command into single quotes:

ssh host 'echo $PWD'

Upvotes: 3

Related Questions