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

Re: [OT] Using aliases or functions in bash script



T o n g wrote:
On Wed, 23 Jan 2008 20:47:15 -0900, Ken Irving wrote:

An advanced bash alias expansion question -- How can I use my aliases or functions in my bash script?

PS. I even tried the following but it didn't work either:

  $ bash -O expand_aliases -c '. ~/.bashrc; (rd /tmp/ttt; alias rd; dt bin; type dt)'


$ cat .bashrc

alias rd="echo foo"
$ bash -c 'alias rd'
bash: line 0: alias: rd: not found
$ bash -c '. ~/.bashrc; alias rd'
alias rd='echo foo'
$ bash -c '. ~/.bashrc; (alias rd)'
alias rd='echo foo'

As far as I can see, your last attempt should have worked.


Reply to: