On 2006-09-10 Frank Berger <[EMAIL PROTECTED]> 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 do 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 e.g. 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 <http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_04_03> -- 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 _______________________________________________ Bug-findutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-findutils
