Level Up

by
Annika Backstrom
in misc, on 9 November 2012. It is tagged #Personal, #Scripting, #Bash, and #Terminal.

Last month I tweeted about the progression one might see as he gets more comfortable in a terminal window (in my case, bash). Archived here, for posterity: repeating the last command you typed into bash.

Level 1, history via the up arrow:

$ <Up><CR>

Level 2, history without the arrow:

$ <C-P><CR>

Level 3, parameter expansion:

$ !!<CR>

Level 4, loop that waits for enter key:

$ while true ; do cmd ; read foo ; done

Bonus Level 5, loop that waits for filesystem event:

$ while true ; do inotifywait -e modify filename ; cmd filename ; done