Skip to content
The Shell Reliquary

/static/relicario/en/reliquia/bang-menos-n/

Menu

SHL-003 · Events

!-n

The command n lines back, counting from the end.

Instead of the absolute line number, the distance: !-2 is the command before last, !-3 the one before that. !-1 and !! are the same relic under two names.

It's the right designator for alternating between two commands — configure, build, configure again — without counting lines in history.

$ ./configurar.sh
$ ./compilar.sh
$ !-2
./configurar.sh
Two lines back, without checking the number.