zsh-users
 help / color / mirror / code / Atom feed
* [Review Request] Arrays and their usage
@ 2021-05-30 23:24 René Neumann
  2021-05-31  0:28 ` Mikael Magnusson
  2021-05-31 17:36 ` Stephane Chazelas
  0 siblings, 2 replies; 10+ messages in thread
From: René Neumann @ 2021-05-30 23:24 UTC (permalink / raw)
  To: zsh-users

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é


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-01  6:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-30 23:24 [Review Request] Arrays and their usage René Neumann
2021-05-31  0:28 ` Mikael Magnusson
2021-05-31  4:24   ` Bart Schaefer
2021-05-31 19:41   ` René Neumann
2021-05-31 17:36 ` Stephane Chazelas
2021-05-31 20:04   ` René Neumann
2021-05-31 21:42     ` Bart Schaefer
2021-05-31 21:43     ` Lawrence Velázquez
2021-05-31 22:05       ` René Neumann
2021-06-01  5:59     ` Stephane Chazelas

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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