Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在通过 ssh 远程执行命令。是否可以将输出或命令发送到我自己的 shell?(不远程)例如,我想使用彩色输出。我也不介意远程执行回声。但似乎远程机器无法识别语法并引发错误。
ssh myapp " mkdir /some/dir || echo "$(tput setaf 1)ERROR$(tput sgr0)" "
Maybe you need to escape your remote command correctly:
ssh myapp " mkdir /some/dir || echo '$(tput setaf 1)ERROR$(tput sgr0)' "