Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a bash function that will basically wrap an alias, except that it will output what the alias is doing so I don't forget the actual command.


alias abc='cd ~/root'

So when I run it:

'you typed: cd ~/root'
share|improve this question

I'm not entirely sure I understand what you want, but here's a function that wraps the creation of an alias that reminds you what it does:

$ reminderalias() {
> alias $1="echo 'You typed: $2'; $2"
> }
$ reminderalias abc 'cd ~/root'
$ abc
You typed: cd ~/root
$ #CWD is now ~/root

Note that this will have trouble with aliases containing certain special characters (mainly single-quotes as far as I can see).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.