Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[Review Request] Arrays and their usage
- X-seq: zsh-users 26748
- From: René Neumann <lists@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: [Review Request] Arrays and their usage
- Date: Mon, 31 May 2021 01:24:36 +0200
- Archived-at: <https://zsh.org/users/26748>
- List-id: <zsh-users.zsh.org>
Hi *,
I always feel a little unsure around arrays in zsh. I've currently used
the following:
local pkgs=( `makepkg --printsrcinfo | \
sed -n -e 's/pkgname = \(.*\)$/\1/p'` )
pkgs=(${pkgs/#/"$DATABASE/"})
sudo pacman -S $pkgs
Intention: Generate a list of packages, prepend "$DATABASE/", and pass
each modified package as a separate argument to pacman.
Question: Is this the correct/zshonic way of doing this?
I personally find the change of behavior by adding ( ) too easy to
overlook. Is there an alternative with ${(...)}?
Thanks,
René
Messages sorted by:
Reverse Date,
Date,
Thread,
Author