Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Justifying text output
- X-seq: zsh-users 7171
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Thorsten Kampe <thorsten@xxxxxxxxxxxxxxxx>
- Subject: Re: Justifying text output
- Date: Sat, 13 Mar 2004 19:58:56 +0100
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <1iqtnm45dkqid.dlg@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <1mm7og67rpkdy.dlg@xxxxxxxxxxxxxxxx> <1040312105556.ZM22295@xxxxxxxxxxxxxxxxxxxxxxx> <16tfmamy8a3c9.dlg@xxxxxxxxxxxxxxxx> <1040313062454.ZM28736@xxxxxxxxxxxxxxxxxxxxxxx> <1iqtnm45dkqid.dlg@xxxxxxxxxxxxxxxx>
Thorsten Kampe wrote:
> I figured it out: "setopt shwordsplit" made the "extra spaces" and
> "setopt rcexpandparam" made the multiple "[ ok ]". Please advise if
> setting them makes sense - meaning making the life of a zsh non-expert
> easier or more difficult.
Most zsh experts probably set rcexpandparam but not shwordsplit.
Setting shwordsplit makes zsh behave more like other Bourne type
shells. Variables containing spaces are split into separate words when
you expand the variable. Unless you're particularly used to it
working this way, you'll probably find that leaving it unset will make
life easier. If you want something to be split at spaces, it is
generally better to use an array.
rcexpandparam on the other hand tends to make life easier. To see what
it does, try this:
% a=(a b c)
% echo 1${a}2
1a b c2
% setopt rcexpandparam
% echo 1${a}2
1a2 1b2 1c2
Given that you seem to be writing a function or script here, you might
want to consider adding:
emulate -L zsh
to the top of it. That resets all the options to sane values locally
for the function. That way you don't risk breaking your script if you
change your option settings later.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author