[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

OT, simple bash alias expansion question



Hi, 

How can I use my aliases in my bash script?

This seems a very simple question but I just can't get it working. For
example, I have an alias 

alias acpl='apt-cache policy'

and this test file:

$ cat cmd.bash
shopt
alias

acpl apt-cache

Now, no matter how I invoke the script, I always get the error:
cmd.bash: line 4: acpl: command not found

Here is how I invoked:

bash -O expand_aliases cmd.bash 

bash -i cmd.bash 

bash -i -O expand_aliases cmd.bash 
bash -O expand_aliases -i cmd.bash 

Please help. 

Thanks

PS, my environment:

$ bash --version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)

$ uname -rm
2.4.27-2-k7 i686

PPS, don't tell me "do not use alias" please.





Reply to: