Re: alias to the sub shell
- From: "Chris F.A. Johnson" <cfajohnson@xxxxxxxxx>
- Date: Sat, 8 Apr 2006 00:53:49 -0400
On 2006-04-08, Dan Mercer wrote:
"dondora" <koninja@xxxxxxxxxxx> wrote in message news:1144311415.520033.223430@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
: thanks Chris.
: the shell I'm using is korn shell
: the procedure i did is
:
: $ alias -x dir='ls -al'
: $ ksh (goes into the subshell)
This is not a subshell, it's a brand new shell. Subshells
are created explicitly by the use of parentheses or by
command substitution. They are also created in pipelines
or by calling scripts without a shebang.
A script without a shebang is a new process, not a subshell.
FWIW, the use of aliases in scripts for anything other than
abbreviating a long path (and then should be aliased in the script)
is not a Best Practice. Aliases are useful interactively and
probably should be restricted to interactive use.
The bash man page says it best:
For almost every purpose, aliases are superseded by shell
functions.
--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.
- Follow-Ups:
- Re: alias to the sub shell
- From: Dan Mercer
- Re: alias to the sub shell
- References:
- alias to the sub shell
- From: dondora
- Re: alias to the sub shell
- From: Chris F.A. Johnson
- Re: alias to the sub shell
- From: dondora
- Re: alias to the sub shell
- From: Dan Mercer
- alias to the sub shell
- Prev by Date: Re: alias to the sub shell
- Next by Date: How to find the files in a filesystem that has changed within 15 min
- Previous by thread: Re: alias to the sub shell
- Next by thread: Re: alias to the sub shell
- Index(es):
Relevant Pages
|