Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Subscripting without temporaries
- X-seq: zsh-users 7345
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Subscripting without temporaries
- Date: Tue, 13 Apr 2004 17:18:31 +0000
- In-reply-to: <m3y8oz7rw8.fsf@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20040413120053.GA4420@DervishD> <040413082948.ZM20696@xxxxxxxxxxxxxxxxxxxxxxx> <m3y8oz7rw8.fsf@xxxxxxxxxx>
On Apr 13, 12:40pm, Lloyd Zusman wrote:
}
} > txt="Some text [particular text] Another text"
} > print -l $txt[1,$txt[(i)\[]-2] $txt[(r)\[,(R)\]] $txt[$txt[(I)\]]+2,-1]
}
} This is cool. But what options are necessary in order to make this
} work? The commands above produce this output for me:
}
} Some
} text
} [particular
} text]
} Another
} text
unsetopt shwordsplit
or place each of the $txt[...] in double quotes:
print -l "$txt[1,$txt[(i)\[]-2]" "$txt[(r)\[,(R)\]]" "$txt[$txt[(I)\]]+2,-1]"
You'll find that many examples posted to zsh-users assume that arrays are
superior to strings-automatically-split-at-spaces, and therefore assume
that you're using the default zsh setting of no_shwordsplit.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author