Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can a child shell inherit 'alias'es?

990 views
Skip to first unread message

h...@torolab.ibm.com

unread,
May 20, 1998, 3:00:00 AM5/20/98
to

Does anyone know if a child shell can inherit
'alias'es from the parent?

What else DOESN'T the parent shell pass on to
the child?

Thx,
Henry
h...@ca.ibm.com

Niël Lambrechts

unread,
May 21, 1998, 3:00:00 AM5/21/98
to h...@torolab.ibm.com
If you define the alias in the environment file, it should be inherited
by the child.
Here is a list:

Subprocesses inherit:
1. current directory
2. environment variables
3. stdin, stdout, stderr file descriptors

Subshells inherit:
1. Any characteristics defined in environment file
2. Signals that are ignored

It does NOT inherit:
1. Shell variables, except environment variables and those
defined in environment file
2. Handling of signals that are not ignored

Hope this helps.

regards,
Niel Lambrechts

Certified AIX System Administrator
IBM Global Services
South Africa
ni...@za.ibm.com
-------------------------------------------------------------

vcard.vcf

Chan

unread,
May 21, 1998, 3:00:00 AM5/21/98
to

Thx for the advice Niel.
But which environment file are you talking about?
I tried putting the alias under /etc/environment,
but that didn't get passed on.
One more thing:
when I just type:
$ alias
I get
autoload='typeset -fu'
command='command '
functions='typeset -f'
hash='alias -t -'
history='fc -l'
integer='typeset -i'
local=typeset
nohup='nohup '
r='fc -e -'
stop='kill -STOP'
suspend='kill -STOP $$'
type='whence -v'

Where are these aliases coming from?

Thx,
Henry
h...@ca.ibm.com

Niël Lambrechts (ni...@isgaix.co.za) wrote:
: This is a multi-part message in MIME format.
: --------------5EA13327A88F21EEB468C665
: Content-Type: text/plain; charset=us-ascii
: Content-Transfer-Encoding: 7bit
:
: If you define the alias in the environment file, it should be inherited

:
:
:
: --------------5EA13327A88F21EEB468C665
: Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
: Content-Transfer-Encoding: 7bit
: Content-Description: Card for Niël Lambrechts
: Content-Disposition: attachment; filename="vcard.vcf"
:
: begin: vcard
: fn: Niël Lambrechts
: n: Lambrechts;Niël
: org: IBM Global Services
: adr;dom: 30 Baker Street;;Rosebank;Johannesburg;;;
: email;internet: ni...@isgaix.co.za
: title: Certified AIX System Administrator
: tel;work: (011)448-4696
: tel;fax: (011)448-4572/1
: tel;home: 082-573-5690
: x-mozilla-cpt: ;0
: x-mozilla-html: FALSE
: version: 2.1
: end: vcard
:
:
: --------------5EA13327A88F21EEB468C665--
:

Rhonda Thorne

unread,
May 21, 1998, 3:00:00 AM5/21/98
to

I am running AIX 4.2.1 and alias is in /usr/bin. However, you can do a
find ......

find / -name *alias*

and locate it on your system.

Alos, there is a man page on alias that you can review.

Rhonda

Mikko Laitamaki

unread,
May 21, 1998, 3:00:00 AM5/21/98
to

Chan wrote:

>But which environment file are you talking about?
>I tried putting the alias under /etc/environment,
>but that didn't get passed on.
>One more thing:
>when I just type:
>$ alias
>I get
>autoload='typeset -fu'
>command='command '

...


>Where are these aliases coming from?
>


If you are using ksh ...
your first shell (login shell) executes /etc/profile and
$HOME/.profile files and alla aliasses defined in those
files are then by use in that login-shell. But if you
start a new ksh the aliasses defined are not usable. For that
reaseon it is usual to define an enviroment file usually
one for each user named by example $HOME/.kshrc . If you
want to use aliasses in shells not started as login shell,
you need to insert enviroment variable ENV to point to that
file in your own .profile or in systemwide /etc/profile file.

A line "export ENV=$HOME/.kshrc" would set it in one or other.
And then put your aliases in .kshrc -file.

$ echo $ENV
/home/mla/.kshrc
$
$ cat ~/.kshrc

alias l='ls -F'
alias del='rm -i'
...

$


--
mam...@uta.fi Mikko Laitamaki University of Tampere
-- Will Bill bill You? --
get Dilbert Unproductivity Toolkit

Garry Garrett

unread,
May 22, 1998, 3:00:00 AM5/22/98
to

Just to be clear, what shell are we talking about? Korn? C-Shell?
Obviously not Borne in that Borne shells don't have aliases. Do
your comments apply to all shells?

--
-----------------------------------------------------------------------
Garry J. Garrett I can't put my e-mail address in my
CSG Systems, Inc. ._o .signature file (without getting a ton
2525 North 117th Ave. |> of spam e-mail), so see my personal
Mailstop 2-A 4 web page for a "mailto:" tag to send me
Omaha, NE 68164-3679 e-mail.

CSG Systems - http://www.csgsys.com/
My Homepage - http://monarch.papillion.ne.us/~ggarrett
http://198.247.210.200/~ggarrett (if their DNS is still broke)

Norman Levin

unread,
May 25, 1998, 3:00:00 AM5/25/98
to

> ------------------------------

>
> From: h...@toraix1.torolab.ibm.com (Chan)
> Date: 21 May 1998 16:58:13 GMT
> Subject: Re: Can a child shell inherit 'alias'es?
>
> Thx for the advice Niel.
> But which environment file are you talking about?
> I tried putting the alias under /etc/environment,
> but that didn't get passed on.
> One more thing:
> when I just type:
> $ alias
> I get
> autoload='typeset -fu'
> command='command '
> functions='typeset -f'
> hash='alias -t -'
> history='fc -l'
> integer='typeset -i'
> local=typeset
> nohup='nohup '
> r='fc -e -'
> stop='kill -STOP'
> suspend='kill -STOP $$'
> type='whence -v'
>
> Where are these aliases coming from?
>
> Thx,
> Henry
> h...@ca.ibm.com
>
> Niël Lambrechts (n
While alias's can be passed to sub-shells, IF the shell is used to start
a login shell such as ksh, bsh or csh, the alias's are NOT passed on.
Thus, the ENV variable in ksh is used to propogate alias to su'd shells.
The alias you are listing are the built in alias to the kshell.
--

Norman Levin
VM/dynAmIX Inc.


Hemant Shah

unread,
May 27, 1998, 3:00:00 AM5/27/98
to

While stranded on information super highway Chan wrote:
:)Thx for the advice Niel.
:)But which environment file are you talking about?
:)I tried putting the alias under /etc/environment,
:)but that didn't get passed on.
:)One more thing:
:)when I just type:
:)$ alias
:)I get
:)autoload='typeset -fu'
:)command='command '
:)functions='typeset -f'
:)hash='alias -t -'
:)history='fc -l'
:)integer='typeset -i'
:)local=typeset
:)nohup='nohup '
:)r='fc -e -'
:)stop='kill -STOP'
:)suspend='kill -STOP $$'
:)type='whence -v'
:)
:)Where are these aliases coming from?
:)
:)Thx,
:)Henry
:)h...@ca.ibm.com
:)


All the exported variables will be available to child process.
If you want to export alies then use "alias -x"

Example:

alias -x ll="ls -l"


IMHO exporting alias is bad idea. I always rely on absolute path in my
scripts.

--
Hemant Shah, LIDP Inc. /-------------------\ ^~~~~^
Voice: +1 630 960 0133 x 664 |TECHNOLOGY | | |
Fax: +1 630 960 0717 |No place for wimps | o|-OO-|o
E-mail: sh...@xnet.com | -Dilbert |--- | () |
\-------------------/ | |
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.

0 new messages