问题描述
我想通过ssh连接传递变量,就像这样:
I'm trying to pass a variable through a ssh connection, like this:
working_dir =/ home / user中/ some_dir /
SSH $ USER @ some_host'的qsub $ working_dir / some_file.txt
连接本身的建立,但这code使我有以下错误:
The connection itself is established, but this code gives me the following error:
working_dir:未定义变量
这可以通过一个事实,即远程机器不具备的变量来解释, $ working_dir
,因为它是本地定义。
This could be explained, by the fact that the remote machine doesn't have the variable $working_dir
since it was defined locally.
有没有在命令在本地获得的价值的一种方式?
Is there a way of getting the value in the command locally?
推荐答案
尝试使用双引号,应在本地计算变量:
Try using double quotes, that should evaluate the variable locally:
SSH $ USER @ some_host的qsub $ working_dir / some_file.txt
这篇关于通过ssh不起作用传递变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!