bug-coreutils
[Top][All Lists]
Advanced

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

bug#20733: [PATCH] doc: mention 'for' syntax issue on older shells


From: Stephane Chazelas
Subject: bug#20733: [PATCH] doc: mention 'for' syntax issue on older shells
Date: Thu, 4 Jun 2015 21:36:17 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2015-06-04 14:06:03 -0600, Eric Blake:
[...]
> +$ @kbd{cat Makefile}
> +list =
> +bad:
> +     @@for arg in $(list); do echo $$arg; done
> +good:
> +     @@list='$(list)'; for arg in $$list; do echo $$arg; done
[...]

Another option is to use:

   for arg in $${-+$(list)}; do echo $$arg; done


That's ${var+value} that expands to value if var is set. $- is
always set. $0 could also be used instead.

-- 
Stephane






reply via email to

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