Command-Line
不能通過管道輸入差異?
我想聰明一點,將遠端文件與本地文件進行比較,而無需先手動下載它。我可以通過以下方式獲取遠端文件的內容
ssh user@remote-host "cat path/file.name"
然而,管道到
diff
ssh user@remote-host "cat path/file.name" | diff path/file.name
給了我這個:
diff: missing operand after `path/file.nae' diff: Try `diff --help' for more information.
我設置了 ssh 密鑰,所以它不會提示我輸入密碼。對此有什麼解決方法?
用於
-
表示標準輸入:ssh user@remote-host "cat path/file.name" | diff path/file.name -
這是一種解決方法:
diff
似乎接受 <( expr ) 作為爭論:diff <(ssh \"cat path/file.name/") <(cat path/file.name)