Talk:Loop over multiple arrays simultaneously: Difference between revisions

Content added Content deleted
(Add very ugly code for UNIX Shell.)
Line 20: Line 20:


: I'd vote for getting rid of the "fancy" C code entirely: it really feels like a C++ programmer's idea of C. But I'm probably alone on this. --[[User:Ledrug|Ledrug]] 22:02, 22 July 2011 (UTC)
: I'd vote for getting rid of the "fancy" C code entirely: it really feels like a C++ programmer's idea of C. But I'm probably alone on this. --[[User:Ledrug|Ledrug]] 22:02, 22 July 2011 (UTC)

== UNIX Shell ==
I wrote this very ugly code for [[Bourne Shell]]...

<lang bash>a=a:b:c
b=A:B:C
c=1:2:3

IFS=:
paste -d ':' /dev/fd/3 /dev/fd/4 /dev/fd/5 3<<ENDA 4<<ENDB 5<<ENDC |
`printf '%s\n' $a`
ENDA
`printf '%s\n' $b`
ENDB
`printf '%s\n' $c`
ENDC
while read -r e3 e4 e5; do
printf '%s%s%s\n' $e3 $e4 $e5
done</lang>

...and then I remembered about <code>shift $i</code>, so I never put this code on our task page. --[[User:Kernigh|Kernigh]] 21:03, 28 July 2011 (UTC)