Shell 設計入門: | ||
---|---|---|
<<< Previous | 18.歷史記錄 | Next >>> |
比如上一個命令是 cp test.txt /home/ols3:
我可以用 ls !:2* 來取得 cp test.txt /home/ols3 中的第 2 個以後的參數,即 /home/ols3
上式 ls !:2* 就如同 ls /home/ols3 一樣
echo !:1* 則可以秀出上一個命令中所有的參數
echo !:1 可以秀出上一個命令中第 1 個參數 (test.txt)
echo !:2 可以秀出上一個命令中第 2 個參數 (/home/ols3)
其它依此類推。
<<< Previous | Home | Next >>> |
取用歷史記錄的最後一筆 | Up | 實例 |