[Top][All Lists]

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

Re: inconsistent field splitting

From: Pierre Gaston
Subject: Re: inconsistent field splitting
Date: Thu, 19 Aug 2010 12:40:23 +0300

On Thu, Aug 19, 2010 at 12:32 PM, Marc Herbert <address@hidden> wrote:
> Since inconsistency is basically "not the same rule
> everywhere", it typically shows in (good) documentation. Indeed:
> http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06
>  2.6 Word Expansions
>  Not all expansions are performed on every word, as explained in the
>  following sections.
> The above sentence leaves open the scary possibility of a large number
> of combinations and special cases, but of course it is not that badly
> inconsistent.
> Focusing back on field splitting, both the opengroup and the (similar)
> bash manual have the same documentation logic: they apparently never
> explicit where field splitting is performed (only before/after which
> expansions it is performed when it is).

> So to understand where field splitting is performed the reader must
> assume that it is performed everywhere, except when it is exceptionally
> missing from an exhaustive list of expansions ("case", assignment,...).
> Unclear and inconvenient.

well, at least the assignment case is clearly documented:

"Word  splitting  is  not performed,  with the exception of "$@" as
explained below under Special
 Parameters.  Pathname expansion is not  performed.
 Assignment  statements  may  also  appear  as  arguments to the alias,
declare, typeset, export, readonly, and local builtin commands."

> Of course the best alternative is the one mentioned by Greg: assume
> that field splitting is consistently performed everywhere and keep
> quoting everything all the time. It is a good habit anyway and
> avoids bugs due to refactoring.

reply via email to

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