Re: Executing an alias inside a scritps
- From: Jon LaBadie <jxlabadie@xxxxxxxxxx>
- Date: Wed, 30 Aug 2006 10:56:35 -0400
Barry Margolin wrote:
In article <1156936740.649889.96490@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
gfiuni2@xxxxxxxxx wrote:
There is a thing that I don't understand. The ".kshrc" file is executed
each time a new instance of ksh is started. Is not this the case when I
run a script?
By default, aliases are only expanded in interactive shells. When you run a script, the shell is non-interactive.
I don't believe this is accurate.
Aliases defined within the script are expanded.
What often is the case is whether the "$ENV" file, typically ~/.bashrc,
is automatically sourced when starting a non-interactive instance of ksh.
The intended, primary purpose for aliases is to assist in your interactive
shell session. For example, I like the protection of the "-i" option of rm.
Thus I alias rm='rm -i'. But I would not like my scripts to pause, waiting
for my response, every time they remove a file.
If you really want to use aliases in a script, define them in the script.
Alternatively if certain aliases are used by many scripts, but them in a
separate file in your 'lib' directory and source them in with ". ~/lib/myaliases".
.
- References:
- Executing an alias inside a scritps
- From: gfiuni2
- Re: Executing an alias inside a scritps
- From: gfiuni2
- Re: Executing an alias inside a scritps
- From: Barry Margolin
- Executing an alias inside a scritps
- Prev by Date: Getops usage with options and argumets. Please Help
- Next by Date: Unix Format Question
- Previous by thread: Re: Executing an alias inside a scritps
- Next by thread: Filetypes & Extensions
- Index(es):
Relevant Pages
|