[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Word splitting and arithmetic expansion

From: Chet Ramey
Subject: Re: Word splitting and arithmetic expansion
Date: Tue, 28 Dec 2010 15:19:27 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20101207 Thunderbird/3.1.7

On 12/28/10 2:50 PM, Jan Schampera wrote:
> Hello list,
> maybe something for old stagers.
> Bash (and POSIX, and Korn, ...) do field/word splitting on the result of
> arithmetic expansions. This is fine, the behaviour per se is not a problem
> at all.
> However, I wonder about the original thought behind it: Is there a specific
> reason or need to let the shell split an arithmetic expansion result?

Arithmetic expansion is a Posix invention.  It's treated just like every
other expansion: split unless double quoted.  There's no compelling
reason to make it behave differently.

> was it just consistency for Korn, "everything is splitted, except the
> expansions where it makes no sense, like pathname expansion"

Pathname expansion happens after word splitting.  Tilde expansion is the
one that's not subject to word splitting.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]