Bash : Reuse the last argument

Let’s say you are waiting for a host to come back online . to ssh into it
you launch a little

ping 192.168.1.33

To see when the host return online ,

when the host finally ping , you can ctrl+c to kill the ping , and launch

ssh !$

this will have the effect of launching ssh with the previous argument of the last command , in this case 192.168.1.33

 

Leave a Comment

Your email address will not be published. Required fields are marked *