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.
是否可以在另一个heredoc 中编写heredoc?
ssh -T -q yxz@server1 <<-"END_TEXT" . . ssh -T -q abc@server2 <<-"SUB_TEXT" . . SUB_TEXT . . END_TEXT
但是,如果缩进是用实际的制表符完成的,嵌套的 heredoc 终止符只会在缩进时被识别。空间将不起作用。
所以你可能想做更多类似的事情:
ssh s1 << \eof1 ssh s2 << \eof2 hostname eof2 eof1