Can't get expand_aliases to take effect

Posted by sachmet on Stack Overflow See other posts from Stack Overflow or by sachmet
Published on 2010-03-23T15:17:28Z Indexed on 2010/03/23 18:13 UTC
Read the original article Hit count: 321

Filed under:
|
|

I can't get expand_aliases to take effect in bash. I've tried a lot of different things, and nothing works.

Here's the simple test case:

/bin/bash -c 'shopt -s expand_aliases; alias cdtmp="cd /tmp"; alias; cdtmp; pwd;'

And the output:

$ /bin/bash -c 'shopt -s expand_aliases; alias cdtmp="cd /tmp"; alias; cdtmp; pwd;'
alias cdtmp='cd /tmp'
/bin/bash: cdtmp: command not found
/home/user

$ /bin/bash --version
GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

(Yes, I'm using shopt instead of the -O option to bash, just to prove it's being done.)

Any ideas?

© Stack Overflow or respective owner

Related posts about bash

Related posts about alias