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.
このように複数の文字列をネストしたい:
sudo ssh server "awk "/pattern/{print "hello"}1" file > file.tmp"
2 つのネストされた引用符を使用して、コマンドを機能させることができました。
awk "/pattern/{print \"hello\"}1" file > file.tmp
コマンドに変数があるため、単一引用符 (') を使用できません。誰かが私を助けることができますか?
前もって感謝します。
コマンド文字列全体がリモートサーバーのシェルで実行される前に、変数が最初に展開されることを意図している限り、単一引用符を配置できます。
sudo ssh server "echo \"$SOMEVAR\"; awk '/pattern/{print \"hello\"}1' file > file.tmp"