我想通过 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 登录?