LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   The !! command (https://www.linuxquestions.org/questions/linux-newbie-8/the-command-251638/)

brunnopessoa 11-05-2004 07:26 PM

The !! command
 
Hi everyone! I am just figuring out what is the function of the command !! in the bash. It seems it just puts in the command line the command executed just before (in other words, the last executed command), right? What would be its usage if I can do this by just pressing the "up arrow" key?

Tks!

ror 11-05-2004 07:49 PM

not all terminals arrow keys work (and especially true for somethings over SSH and stuff)

so, you get neat other solutions, this is also why vim/emacs have cursor moving keys.

brunnopessoa 11-05-2004 08:03 PM

Makes sense ror. Tks!

And you know it the !-2 command has the same function? And what about !-1, does it exist? What for?

Tks in advance.

Poetics 11-05-2004 10:39 PM

For -really- anal programmers it's also a shortcut if you have to run the same command a few times in a row; slightly smaller program size (depending on program) typing "!!" in rather than a long and complicated command.

Or ... well, who knows

ror 11-05-2004 10:51 PM

yeah it's scriptable unlike the up arrow :)


All times are GMT -5. The time now is 10:54 PM.