[arch-projects] [dbscripts] [PATCH v2 1/5] Use even more bashisms.

Dave Reisner d at falconindy.com
Tue Feb 20 14:02:27 UTC 2018


On Tue, Feb 20, 2018 at 11:59:49AM +0000, Emil Velikov via arch-projects wrote:
> Hi Eli,
> 
> Disclaimer: the following is a bit subtle topic, so I hope it doesn't
> spur a lot of off-topic.
> 
> On 19 February 2018 at 20:11, Eli Schwartz via arch-projects
> <arch-projects at archlinux.org> wrote:
> > Catch some cases that were missed in the previous run.
> >
> > Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
> > ---
> >
> > This patch is new + refactor some changes from:
> > ftpdir-cleanup,sourceballs: replace external find command with bash globbing
> >
> >  cron-jobs/devlist-mailer  |  6 +++---
> >  cron-jobs/ftpdir-cleanup  | 14 +++++++-------
> >  cron-jobs/integrity-check |  2 +-
> >  cron-jobs/sourceballs     | 12 ++++++------
> >  cron-jobs/update-web-db   |  6 +++---
> >  5 files changed, 20 insertions(+), 20 deletions(-)
> >
> Is there any performance or other technical benefit to using more bashisms?

The scripts run under bash, so why not take advantage of bash features?
For example, bash's [[ and (( are less error prone and more featureful
than the POSIX [, and builtins like mapfile and read (POSIX read has an
extremely limited featureset) make I/O far simpler tasks. There's plenty
more to like...

Please don't try to talk about performance and shell in the same
sentence. These are not performance-sensitive scripts, and shell is not
a language to use when performance (of almost any kind) is relevant.

> Reason being, that I am slowly going through different parts of Arch
> making it zsh friendly.
> While keeping the code brief and legible, of course.

Feel free to exemplify how conversion from bash to zsh has aided your
goals while retaining portability to a supermajority of Arch systems.

$ pacman -Q zsh
error: package 'zsh' was not found

> Guessing that I've picked the wrong hobby?

Almost certainly.

> Thanks
> Emil


More information about the arch-projects mailing list