Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: what can be global aliases used for?
On Fri, Feb 17, 2023 at 6:59 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> I wonder what else can global aliases do?
As Roman has already indicated, it's not a recommended practice to
rely on aliases of any kind in scripts. Aliasing is intended as an
interactive feature to reduce time spent typing commonly-used idioms.
That said, the most common use I've seen made of global aliases is
this kind of thing:
alias -g L='|less'
% ls -lLR L
That is, append L instead of "|less" to commands that are expected to
produce many pages of output.
Similarly stuff like
alias -g TODAYS_FILES='-lrt | fgrep "$(date +"%b %2d")" | awk '\''{print $NF}'\'
% ls TODAYS_FILES
(yes, there's a more zsh-ish way to do that, and it could also be a
command alias by sticking the "ls" in front, just using the pipeline
as an example).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author