0

This question already has an answer here:

echo !$ outputs different strings depending on my previous command line call. For example:

mrdumbdumb-redhat:~ mrdumbdumb$ ls
mrdumbdumb-redhat:~ mrdumbdumb$ echo !$
echo ls
ls

mrdumbdumb-redhat:Documents mrdumbdumb$ cd -
/
mrdumbdumb-redhat:~ mrdumbdumb$ echo !$
echo -
-

!$ seems to expand to the last argument of my last command or the command itself if the command lacked arguments.

What exactly is !$?

marked as duplicate by Ramesh, Gilles command-line Sep 8 '14 at 23:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    "!$ seems to expand to the last argument of my last command or the command itself if the command lacked arguments." Yes, that's correct. – Kevin Sep 8 '14 at 23:14
  • If you hadn't made a typo in the title, you'd have noticed that a question with the exact same title already existed. – Gilles Sep 8 '14 at 23:21