Skip to content

Instantly share code, notes, and snippets.

@ryo1kato
Created September 22, 2011 15:05
Show Gist options
  • Save ryo1kato/1235002 to your computer and use it in GitHub Desktop.
Save ryo1kato/1235002 to your computer and use it in GitHub Desktop.
i=0
while :;do echo $((i++)); sleep .3; done | bash -c 'while read L1; do echo L1=$L1; while read -t 0 L2; do echo L2=$L2; break; done; sleep .5; done'
# わかりやすくインデントすると
while :;
do
echo $((i++))
sleep .3
done | bash -c 'while read L1;
do
echo L1=$L1;
while read -t 0 L2;
do
echo L2=$L2;
break;
done;
sleep .5;
done'
# bashだと内側のループ (while read -t 0 L2) で何も読めない。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment