* Re: Help on zsh grammar
[not found] <Pine.SV4.3.95.970122185019.1005B-100000@itsrm1.mow.sni.de>
@ 1997-01-22 19:35 ` Bart Schaefer
1997-01-23 6:31 ` Hrvoje Niksic
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 1997-01-22 19:35 UTC (permalink / raw)
To: Dietmar Rempfer, borsenkow.msk, zsh-users
Redirected to zsh-users ...
On Jan 22, 6:53pm, Andrej Borsenkow wrote:
} Subject: Re: Help on zsh grammar
}
} On Wed, 22 Jan 1997, Dietmar Rempfer wrote:
}
} > Let us define the following function:
} >
} > test () { echo \"$*\" }
} >
} > Now, if I do ``test blabla'', I get "blabla", which is what I want.
} > But if I say e.g. ``test *.aux'', I would like to see "*.aux" printed out,
} > but instead I get the message: zsh: no matches found: *.aux.
You're getting that error before `test' even runs, from the top-level shell
that's parsing the command line. `$*' is -not- being globbed inside `test'.
} What about
} test '*.aux' :-)
}
} But really, you want
}
} unsetopt nomatch
No, he doesn't. What he wants is
test () { echo \"$*\" }
alias test 'noglob test'
Note that the alias must come after the function definition, or else you
define two functions (`noglob' and `test'), both of which do the echo.
(You can use `function test () { ... }' instead, but it's still a good
idea to always define aliases after defining functions.)
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Help on zsh grammar
1997-01-22 19:35 ` Help on zsh grammar Bart Schaefer
@ 1997-01-23 6:31 ` Hrvoje Niksic
1997-01-23 7:23 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Hrvoje Niksic @ 1997-01-23 6:31 UTC (permalink / raw)
To: zsh-users
Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
> alias test 'noglob test'
This should be:
alias test='noglob test'
--
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
"What is the sound of Perl? Is it not the sound of a wall that
people have stopped banging their heads against?" -- Larry Wall
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Help on zsh grammar
1997-01-23 6:31 ` Hrvoje Niksic
@ 1997-01-23 7:23 ` Bart Schaefer
0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1997-01-23 7:23 UTC (permalink / raw)
To: Hrvoje Niksic, zsh-users
On Jan 23, 7:31am, Hrvoje Niksic wrote:
} Subject: Re: Help on zsh grammar
}
} Bart Schaefer (schaefer@candle.brasslantern.com) wrote:
} > alias test 'noglob test'
}
} This should be:
} alias test='noglob test'
Er, yes. I always forget that I use:
alias() {
local cmd eq
if [[ $# -eq 0 ]]
then
cmd=-L
else
cmd="$1"
shift
fi
if [[ $# -gt 0 ]]
then
eq='='
else
eq=
fi
builtin alias "$cmd"$eq"$@"
}
Also, what I said about the order of defining aliases and functions was
not quite what I meant.
The rule is: Define first those aliases you expect to use in the body
of a function, but define the function first if the alias has the same
name as the function.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-01-23 7:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <Pine.SV4.3.95.970122185019.1005B-100000@itsrm1.mow.sni.de>
1997-01-22 19:35 ` Help on zsh grammar Bart Schaefer
1997-01-23 6:31 ` Hrvoje Niksic
1997-01-23 7:23 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).