Re: Why is this not working?
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 05/28/04
- Previous message: Lekeas GK: "Re: Why is this not working?"
- In reply to: Lekeas GK: "Re: Why is this not working?"
- Next in thread: Jens.Toerring_at_physik.fu-berlin.de: "Re: Why is this not working?"
- Reply: Jens.Toerring_at_physik.fu-berlin.de: "Re: Why is this not working?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 27 May 2004 18:13:20 -0400
In article <Pine.GSO.4.58.0405272058001.9008@vega.soi.city.ac.uk>,
Lekeas GK <cj571@soi.city.ac.uk> wrote:
> >> Hi All,
> >>
> >> I am trying to create a script which would look like the which command
> >> under tcsh. I wrote the following script:
> >>
> >> #! /usr/bin/bash
> >> if ! `alias $1`; then
> >> echo "$1 is aliased to " `alias $1|cut -d\' -f2`
> >> fi
> >>
> >> However, when I execute it I get touch is aliased to ( which is not
> >> true, as I have created an alias for touch).
> >
> > Aliases are not exported.
>
> What do you mean aliases are not exported? From where to where? I only
> want alias $1|cut -d\' -f2 to run - as it is within backquotes - and
> produce /usr/bin/touch. However, it is not producing anything and I am
> very curious why this is happening.
Aliases are not exported from your login shell to the shell process that
is executing the script. ~/.bashrc is only executed by default in
interactive shell processes, and the script is being run by a
non-interactive shell.
-- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
- Previous message: Lekeas GK: "Re: Why is this not working?"
- In reply to: Lekeas GK: "Re: Why is this not working?"
- Next in thread: Jens.Toerring_at_physik.fu-berlin.de: "Re: Why is this not working?"
- Reply: Jens.Toerring_at_physik.fu-berlin.de: "Re: Why is this not working?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|