[Ilugc] Echoing the current command

  • From: benignbala@xxxxxxxxx (Balachandran Sivakumar)
  • Date: Wed, 11 Sep 2013 13:50:46 +0530

Hi,

On Tue, Sep 10, 2013 at 9:51 PM, Arun Khan <knura9 at gmail.com> wrote:

On Tue, Sep 10, 2013 at 11:58 AM, Sahil ModGill

$ !$
date
Tue Sep 10 21:49:07 IST 2013


            !$ is a bash variable that expands to "last
term/string/word in the previous command". When you did "ls -l
network-*", !$ would point to network-* - The last term of the
command. When you did "date", it is single-word command. So, !$ would
point to that.

When you do

$ !$

You are asking bash to execute the last term of the previous command.
It would work for date because there is an executable with such a name
in your $PATH. It wouldn't work for network-* because that is not an
executable. Thanks


-- 
Thank you
Balachandran Sivakumar

Arise Awake and stop not till the goal is reached.
                                                             - Swami Vivekananda

Mail: benignbala at gmail.com
Blog: http://benignbala.wordpress.com/

Other related posts: