How to use bash $(awk) in single ssh-command?

后端 未结 6 562
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 21:18

I am trying to execute a single command over ssh that contains `sub-code` or $(sub-code) (I use it all the time but I don\'t know the official name for that) to

6条回答
  •  庸人自扰
    2020-12-02 21:42

    It is better to use a heredoc with ssh to avoid escaping quotes everywhere in a more complex command:

    ssh -T myServer <<-'EOF'
    uname -a | awk '{print $2}'
    exit
    EOF
    

提交回复
热议问题