bug-bash
[Top][All Lists]
Advanced

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

Re: Characters aren't being properly escaped/evaluated in a Bash


From: Chet Ramey
Subject: Re: Characters aren't being properly escaped/evaluated in a Bash
Date: Thu, 10 May 2007 09:28:12 -0400

> Bash Version: 3.0
> Patch Level: 0
> Release Status: release
> 
> Description:
> 
>       Summary:
>               Characters aren't being properly escaped/evaluated in a Bash
> 
>       Full Description:
> 
>               I'm trying to take a series of lines in a file like so (ignore 
> 1.-3. characters -- they're just there for
>               visual breaking):
> 
>               1. This is a file with multiple
>               2. fields spread across multiple
>               3. lines.
> 
>               and group it up into line by line groups, and analyze with
>               "for" in bash.

`for' isn't really appropriate for this job, since most of the common
idioms perform too much or too little word splitting.  It's better to
use a `while read' loop and quote the variable containing the line
when you use it.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                                Live Strong.
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.case.edu/~chet/




reply via email to

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