Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: read & leading (and trailing) spaces
- X-seq: zsh-users 14109
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: read & leading (and trailing) spaces
- Date: Tue, 12 May 2009 08:09:53 -0700
- In-reply-to: <20090512074013.66710.qmail@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090512074013.66710.qmail@xxxxxxxxxxx>
On May 12, 7:40pm, Atom Smasher wrote:
}
} this doesn't work as advertised when the input includes leading and/or
} trailing spaces:
} read -r foo ; print -r -- "${foo}"
As advertised where? The doc is silent on the treatment of leading and
trailing spaces; under -r, it says only that backslashes aren't special.
(The doc probably *shouldn't* be silent but that's another matter.)
I think you'll find that "read" in ksh, bash, etc. also removes leading
and trailing IFS characters, even with -r.
} i can work around that by setting IFS to either null (IFS='') or setting
} it to just a newline (IFS='
} '). should i expect problems (in older or newer versions of zsh) using
} either of those tricks to make read recognize leading/trailing spaces?
You should not expect problems with that, it's standard IFS behavior.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author