[Top][All Lists]

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

Re: updatedb conversion to sh bug

From: Andreas Metzler
Subject: Re: updatedb conversion to sh bug
Date: Sun, 10 Sep 2006 08:49:41 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On 2006-09-10 Frank Berger <address@hidden> wrote:
> old=no
> for arg
> do
>   opt=`echo $args|sed 's/^\([^=]*\).*/\1/'`
>   val=`echo $args|sed 's/^[^=]*=\(.*\)/\1/'`
> ----
> The last two lines should be:
> ----
>   opt=`echo $@|sed 's/^\([^=]*\).*/\1/'`
>   val=`echo $@|sed 's/^[^=]*=\(.*\)/\1/'`
> ----

Nope. You seem to have made a copy'n'paste error, the respective lines
actually read:

for arg
  opt=`echo $arg|sed 's/^\([^=]*\).*/\1/'`
  val=`echo $arg|sed 's/^[^=]*=\(.*\)/\1/'`

(Note $arg instead of $args!.)

And this is a correct for-loop. - The usual syntax for a for-loop is

for blah in word ; do ... ; done
for x in blah bar ; do echo $x ; done

However the [in word] is optional, omitting it is be equivalent to
[in "$@"], i.e. looping through the positional parameters.

cu andreas
The 'Galactic Cleaning' policy undertaken by Emperor Zhark is a personal
vision of the emperor's, and its inclusion in this work does not constitute
tacit approval by the author or the publisher for any such projects,
howsoever undertaken.                                (c) Jasper Ffforde

reply via email to

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