help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: what can be global aliases used for?
Date: Fri, 17 Feb 2023 11:10:39 -0800	[thread overview]
Message-ID: <CAH+w=7adGGE=OeBZY7zK4+U8ixEo0G-7RpOQ+KCqvO5pE3rHcA@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVAX3oJdrJDiqjxsLMH5+DaYt09dwzqA01ZBEY3rWwd_5A@mail.gmail.com>

On Fri, Feb 17, 2023 at 6:59 AM Sebastian Gniazdowski
<sgniazdowski@gmail.com> 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}'\'

(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).

  parent reply	other threads:[~2023-02-17 19:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKc7PVA0X1786JP7g69aDP8eL+1oAZpipVC-4BNm1KV=OPxe7A@mail.gmail.com>
2023-02-17 14:54 ` Sebastian Gniazdowski
2023-02-17 17:15   ` Roman Perepelitsa
2023-02-17 19:10   ` Bart Schaefer [this message]
2023-02-17 21:11   ` Lawrence Velázquez
2023-02-17 21:19     ` Roman Perepelitsa
2023-02-17 23:27       ` Lawrence Velázquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7adGGE=OeBZY7zK4+U8ixEo0G-7RpOQ+KCqvO5pE3rHcA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).