相关疑难解决方法(0)

将变量定义传递给 ssh 中的特定 shell

我想通过 ssh 连接到具有预定义设置的机器,特别是在 zsh 中。

为此,我尝试从客户端执行以下操作(受此答案启发):

$ ssh -t machine@domain "STARTUP_OPTION='A'; exec /path/to/zsh;"
Run Code Online (Sandbox Code Playgroud)

然后我.zshrc在服务器中有以下内容:

if [ "$STARTUP_OPTION" = "A" ]; then
    echo "Logging in with A"
fi
Run Code Online (Sandbox Code Playgroud)

这似乎不起作用。在远程 shell 中传递 shell 变量的值时,如何使用特定的 shell 登录?

login ssh zsh

1
推荐指数
1
解决办法
356
查看次数

标签 统计

login ×1

ssh ×1

zsh ×1