เรียกใช้ Last argument ใน Unix
Published in
1 min readNov 11, 2016
ตัวอย่างจาก: http://stackoverflow.com/questions/3371294/how-can-i-recall-the-argument-of-the-previous-bash-command
> ls a.txt b.txt
> !:1
> a.txt
> !:1-2
> a.txt b.txt
> !:10-12
The !
prefix is used to access previous commands.
Other useful commands:
!$
- last argument from previous command!^
- first argument (after the program/built-in/script) from previous command!!
- previous command (often pronounced "bang bang")!n
- command numbern
fromhistory
!pattern
- most recent command matchingpattern
!!:s/find/replace
- last command, substitutefind
withreplace