Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Alias call in function fails...
Bart Schaefer wrote on Tue, Jun 23, 2020 at 16:40:04 -0700:
> On Tue, Jun 23, 2020 at 3:55 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > I[...] it's perhaps not self-explanatory that nl(1) is an
> > external command.
>
> You could use "cat -n" instead.
It's unportable. I'd prefer a runnable example.
How about:
[[[
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index ada69c99a..d35cad182 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -105,7 +105,13 @@ For each var(name) with a corresponding var(value), define an alias
with that value. A trailing space in var(value) causes the next word
to be checked for alias expansion. If the tt(-g) flag is present,
define a global alias; global aliases are expanded even if they do not
-occur in command position.
+occur in command position:
+
+example(% perldoc --help 2>&1 | grep 'built-in functions'
+ -f Search Perl built-in functions
+% alias -g HG='--help 2>&1 | grep'
+% perldoc HG 'built-in functions'
+ -f Search Perl built-in functions)
If the tt(-s) flag is present, define a suffix alias: if the command
word on a command line is in the form `var(text)tt(.)var(name)', where
]]]
The example uses perldoc(1) because that command is an external command,
is not system-dependent, and prints usage information to stderr when
invoked with --help.
There's already an example of «| less» in StartupFiles/zshrc:61.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author