我想做一個SSH連接到遠程主機,那裏我想運行多個命令。Linux與多個命令的SSH
ssh -l blabla 123.123.123.123 ls -l
當我運行這一點,我會得到的ls -l on 123.123...
結果是有可能,做出某事像這樣:
ssh -l blabla 123.123.123.123 ls -l & ifconfig
...它試圖這樣:
ssh -l blabla 123.123.123.123 ls -l; ifconfig
但那裏有本地bash運行第二個命令。 我想讓第二個命令在遠程主機上運行。
謝謝!
嘗試引用'&'和';這樣的'字符:'ssh user @ host ls -l \; ifconfig' – Sven
''ssh user @ host'command1;命令2; command3''' –
兩者都不起作用。用\;這個被轉換爲正常字符。與「...; ...」是一樣的結果:兩個命令都是一個命令。遠程服務器嘗試執行:>> ls -l \ ifconfig << or >> ls -l; ifconfig << – Mace