[Ilugc] Echoing the current command

  • From: tshrinivasan@xxxxxxxxx (Shrinivasan T)
  • Date: Tue, 10 Sep 2013 11:55:56 +0530

On Tue, Sep 10, 2013 at 11:35 AM, Balasubramaniam Natarajan
<bala150985 at gmail.com> wrote:


Hi

How do I echo the current command which I typed in bash ?  I know that our
current command goes and sit's in the value of "$0"  However when I try
putting this inside .bashrc it does not give me correct results.



If you're trying to update the title of the xterm, you can use a DEBUG trap:

trap 'echo "$BASH_COMMAND"' DEBUG

Not the same as you expect.
But it gives the command name executed.

Thanks to :
http://stackoverflow.com/questions/5077836/bash-how-to-find-current-shell-command



 --

Regards,
T.Shrinivasan

My Life with GNU/Linux : http://goinggnu.wordpress.com
Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com

Get CollabNet Subversion Edge :     http://www.collab.net/svnedge

Other related posts: