เรียกใช้ Last argument ใน Unix

imKrish Developer
imKrish
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 number n from history
  • !pattern - most recent command matching pattern
  • !!:s/find/replace - last command, substitute find with replace

--

--

imKrish Developer
imKrish

I’m going to be the best I could be, not someone tells me I should be. I am optimistic and I love freedom : )