Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
read options to slurp empty lines ?
- X-seq: zsh-users 23424
- From: Marc Chantreux <eiro@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: read options to slurp empty lines ?
- Date: Fri, 1 Jun 2018 23:47:14 +0200
- Dkim-filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org 7EBE710A7E
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1527889638; bh=X+t1v+V/+pwXHNT2ZN2lXKz2xCqMZD9PmmII2WSErss=; h=Date:From:To:Subject:From; b=JNkK2tCilfXGhh1b3KnITtdYPnIFMm5np/NM9Tq1apHHh6IMAjbsWk4gW+GxG1MrW RYX7oszOpn3ZoPWjUhIO3IjAcm+cAQXDj0Q+9f4Pc/r7St9q1aGIOo2Y51L8YkEwAq 76NNT+hR2qpZBf5G6idauzyjLGtKw3KZJloSVtRBUxljVDAoKf57ngAsZZY4WTQ3Dr rU4uDl1pMW9WiK/74wsO8yiqs8WAGBwAhNkSsUchl7SeOw+LCHvtVV0Sci6RLaOkz4 5vXPm0LbSjzM3em61+e/YaQzFD6P4CROcy8q2Qcw6hpoWoDJvARY4W2lzOJLtDKLcd Xd0EA3mIMsosQ==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
hello people,
i'm very unhappy with the patch i made on uze.zsh today
https://github.com/zsh-uze/uze/commit/b695fff8d4b2b5dd91ca9033c8d98ac3c3badeef#diff-ea0555d620dfb73b2eda6e587c48d7b1L40
i use to have slurp function made like this
slurp () IFS=$'\n' read -r -d ' -A $1
so i am able to write
print -l foo bar bang | slurp them
# got them=( foo bar bang )
i recently saw that
print -l '' bar bang '' | slurp them
# got them=( bar bang )
# expected them=( '' bar bang '' )
i tried to patch it using some read options and
slurp () {
local it
local n=${1:-them}
set --
while { IFS= read -r it }
do
set -- "$@" "$it"
done
set -A $n "$@"
}
which is way much longer. did i miss something using read builtin ?
regards
marc
Messages sorted by:
Reverse Date,
Date,
Thread,
Author