Thread View: gnu.bash.bug
4 messages
4 total messages
Started by Stephan Bechtolsheim
Mon, 31 Aug 1992 15:28
alias
Author: Stephan Bechtolsheim
Date: Mon, 31 Aug 1992 15:28
Date: Mon, 31 Aug 1992 15:28
18 lines
769 bytes
769 bytes
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..... StvB P.S. Thank you. . .
Re: alias
Author: Robert Elz
Date: Tue, 01 Sep 1992 22:28
Date: Tue, 01 Sep 1992 22:28
7 lines
700 bytes
700 bytes
In <19390@ector.cs.purdue.edu> svb@cs.purdue.edu (Stephan Bechtolsheim) writes: | How do you get, in an alias, the rest of the command line expanded? In bash you don't - you use a function instead. kre
Re: alias
Author: 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_______________________________________________________________/
Re: alias
Author: Robert Elz
Date: Wed, 02 Sep 1992 20:25
Date: Wed, 02 Sep 1992 20:25
19 lines
791 bytes
791 bytes
In <1992Sep2.000915.16261@wdl.loral.com>
mdm@wdl1.wdl.loral.com (Mike D Marchionna) writes:
| function xdsp () { declare -x DISPLAY=$1:0.0 }
Try not using declare, as in
mulga$ g()
> {
> AAA=$1
> export AAA
> }
mulga$ g hello
mulga$ echo $AAA
hello
Whether the way "declare" works is a bug or not someone else can say.
kre
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads