2
任何人都可以解釋以下內容嗎?當我使用ssh遠程執行歷史記錄時,不會產生輸出,甚至其他遠程命令也會產生輸出,並且在該機器上有歷史記錄。ssh host'history |尾巴'產生沒有輸出
ssh host 'history | tail' # produces no output
ssh host 'echo foo | tail' # produces 'foo' as output
ssh host
> history | tail # produces expected output
輝煌。你能澄清一下「歷史-r」是什麼嗎?謝謝。 –
@GirishRao:'help history'表示'history -r'讀取歷史文件並將其內容追加到歷史列表中。這就是爲什麼我在回答中說「加載它」。 –
奇怪:我注意到'ssh -t localhost「HISTFILE =〜/ .bash_history; set -o history; export HISTTIMEFORMAT ='%F%T'; history -r; history」'沒有給我正確的時間戳;它只是填充所有行的當前時間戳 - 以任何方式獲得正確的時間? – rupert160