Register
It is currently Sun Mar 29, 2015 8:35 pm

Show alias replacement value instead of alias


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Thu Dec 11, 2014 10:02 am   

Joined: Thu Dec 11, 2014 9:53 am
Posts: 1
How can I see the value of the last command as executed? Given an alias:
Code:
alias gs='git status'
, when I run gs how can I see that the real executed command was git status, even though my history file shows gs.

Without the ability to do this, history files are only meaningful to user who ran them and not portable among users in a useful way.

Thanks!


Top
 Profile  
 PostPosted: Wed Jan 14, 2015 7:29 pm   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 92
There is no direct way to to this.

But you can use a short script doing this.
The bash knows an assoc array named BASH_ALIASES
With it you can easily use awk to do it.

To get an idea of this try
Code:
for a in "${!BASH_ALIASES[@]}"; do
   printf '%-10s --> %s\n' "$a" "${BASH_ALIASES[$a]}"
done


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP