dash, ash for loop oddity

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

 



Hi,

according to the grammar
<http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_10_02>

| for_clause       : For name linebreak                            do_group
|                  | For name linebreak in          sequential_sep do_group
|                  | For name linebreak in wordlist sequential_sep do_group
| [...]
| linebreak        : newline_list
|                  | /* empty */

the following script should be legal:

#####
#!/bin/dash
for i
in a b c
do
echo $i
done
#####

but it fails with:

| ./a.sh: 3: Syntax error: "in" unexpected (expecting "do").

bash, zsh and NetBSDs ksh are doing fine while NetBSDs sh, based on ash
fails, too.

Max


--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux