Article View: gnu.bash.bug
Article #927Re: alias
From: Mike D Marchionna
Date: Wed, 02 Sep 1992 00:09
Date: Wed, 02 Sep 1992 00:09
42 lines
1835 bytes
1835 bytes
svb@cs.purdue.edu (Stephan Bechtolsheim) writes:
>How do you get, in an alias, the rest of the command line expanded?
>If I write
> alias xx='echo abc 777 def'
>and
> xx this is fun
>should print
> abc this is fun def
>What do I need to write instead of the '777'? Could not find
>anything in the documentation. It's a bug in that it's not documented .......
>Verson 1.12.....
Well I'm having similar difficulty with version 1.10. I know I can get
the above example to work by using a function instead. For example
function xx () { echo abc $1 def };
But if I try to declare a environment variable within the function, the
variable vanishes after the function completes. This is contrary to the
statement that functions execute each line within the same shell. For
example if try to declare a function to simplify setting by X-Windows
DISPLAY variable like so:
function xdsp () { declare -x DISPLAY=$1:0.0 }
This happens:
declare -x DISPLAY=foo
xdsp lumpy
echo $DISPLAY
foo
Any ideas, or is this just a feature of Bash?
--MDM
--
_________________________________________________________________________
( _______________________________ Brain, and brain! What is brain! )
\________________________________) --Star Trek (Spock's Brain) /
El_Rayo_X_______________________________________________________________/
Technical Details
Message-ID:
<1992Sep2.000915.16261@wdl.loral.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wdl1.wdl.loral.com!mdmReferences:
<19390@ector.cs.purdue.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.bash.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!wdl1.wdl.loral.com!mdm From: mdm@wdl1.wdl.loral.com (Mike D Marchionna) Subject: Re: alias Message-ID: <1992Sep2.000915.16261@wdl.loral.com> Keywords: alias Sender: gnulists@ai.mit.edu Organization: Loral Western Development Labs References: <19390@ector.cs.purdue.edu> Distribution: gnu Date: Wed, 2 Sep 1992 00:09:15 GMT Approved: bug-bash@prep.ai.mit.edu Lines: 43