tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ Cannot do ftp while in tcsh

Du command does not work on my system ▻

using a space in a variable

In article <7kspb1$dnn$1@proxy.evosys.net>,
Brian Dawson <b-dawson@tronicplanet.de> wrote:
>Any suggestions?

You could use rc, which knows something about lists.

    ; x = ('item 1' 'item 2')
    ; for (i in $x) { echo $i }
    item 1
    item 2

In the Bourne shell, you could use a separator between the items which
you know isn't going to appear within them, then set IFS to split the
string at those separators.

    $ x='item 1,item 2'
    $ (IFS=,
    > for i in $x; do
    > echo $i
    > done)
    item 1
    item 2

Tim.
--
Tim Goodwin   | `I can't believe that someone is releasing
University of | something called "Unix" without something
Leicester, UK | called "/bin/sh".' -- Randal L. Schwartz

Original headers:

From: tjg@ltpcg.star.le.ac.uk (Tim J Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: using a space in a variable
Date: 24 Jun 1999 12:31:17 +0100
Organization: University of Leicester, UK
Message-ID: <7kt4u5$kfu$1@ltpcg.star.le.ac.uk>
References: <7kspb1$dnn$1@proxy.evosys.net>

△ comp.unix.shell △

◅ Cannot do ftp while in tcsh

Du command does not work on my system ▻