DEV Community

Discussion on: Bash Quick Tips

Collapse
 
jpchateau profile image
Jean-Philippe Chateau

Hi! Instead of creating an alias to go in the directory you just created, I suggest using !$ to recall the last argument. Although it does not save a command, it avoids retyping.

Example:
$ mkdir my_directory
$ cd !$

Btw, nice article. Thank you for the tips!

Collapse
 
jwkicklighter profile image
Jordan Kicklighter

Thank you! I knew there was a way to use the previous arg, but I couldn't remember it when I was writing (I guess I could've looked it up 😅). So thanks for the tip!

I do still like that mkc is shorter than even mkdir because I'm just that lazy.

Collapse
 
jorotenev profile image
Georgi Tenev

Isn't @ the arg received? $_ is the previous arg if I'm not mistaken