zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Thorsten Kampe <thorsten@thorstenkampe.de>
Cc: zsh-users@sunsite.dk
Subject: Re: Justifying text output
Date: Sat, 13 Mar 2004 19:58:56 +0100	[thread overview]
Message-ID: <3306.1079204336@trentino.logica.co.uk> (raw)
In-Reply-To: <1iqtnm45dkqid.dlg@thorstenkampe.de>

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


  reply	other threads:[~2004-03-13 19:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-12  2:01 Thorsten Kampe
2004-03-12 10:55 ` Bart Schaefer
2004-03-12 23:24   ` Thorsten Kampe
2004-03-13  6:24     ` Bart Schaefer
2004-03-13 17:48       ` Thorsten Kampe
2004-03-13 18:58         ` Oliver Kiddle [this message]
2004-03-12 10:59 ` Peter Stephenson
2004-03-12 22:33   ` Thorsten Kampe
2004-03-13  3:29   ` Thorsten Kampe
2004-03-12 11:28 ` Oliver Kiddle
2004-03-12 22:33   ` Thorsten Kampe
2004-03-12 23:03     ` Pavol Juhas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3306.1079204336@trentino.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=thorsten@thorstenkampe.de \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).