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

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



On Sat, 26 Jan 2008 23:40:02 +0000, William Pursell 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)'
> 
> The point of my previous response, which I complete failed to
> make (and in fact didn't realize until after I'd sent it...)
> is that your .bashrc probably includes a line of the form:
> [ -z "$PS1" ] && return
> 
> So that the bashrc returns prior to defining any aliases. . .

OMG, that's EXACTLY the reason!

NEARLY THREE YEARS[1] has the question been haunting me, and you solve it, 
by identifying my culprit line via looking through a crystal ball :-). 

Thanks a million William!!!

[1] http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2005-06/0416.html

-- 
Tong (remove underscore(s) to reply)
  http://xpt.sourceforge.net/techdocs/
  http://xpt.sourceforge.net/tools/


Reply to: