I need a remote machine to print the absolute path of a given file hosted on it, so I do:

ssh me@remote.host.net "echo '$(pwd)/file.txt'"

Too bad this way pwd gets evaluated locally, not remotely. How can I do this?

有帮助吗?

解决方案

Flip the quotes:

ssh me@remote.host.net 'echo "$(pwd)/file.txt"'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top