[Top][All Lists]

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

Re: [Help-bash] how to translate one file

From: Eric Blake
Subject: Re: [Help-bash] how to translate one file
Date: Tue, 03 Jan 2012 10:00:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/03/2012 09:43 AM, lina wrote:
>> or to use this portable alternative:
>> while read line; do
>>    if [ ${#line} = 30 ]; then
>>      case $line in \") echo "$line" ;; esac
> case $line in \"*) can print the expected results well. ^_^
> May I ask here why you use ";;" not one ; .

Habit.  The grammar of 'case' requires ';;' (as a single token) as the
terminator between all non-final patterns, and while the use of ';;' is
optional after the last pattern, I find it easier to be in a habit of
consistently using ';;' to terminate ALL case statement patterns than to
mentally debate whether I can omit it because it is the last pattern.
Doing this also makes maintenance of a scripts easier - if I change my
mind and add a new pattern at the end later, I just have to add the new
pattern rather than also edit the previous pattern to add ';;'.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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