Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux ginger 4.18.0-240.15.1.el8_3.x86_64 #1 SMP Mon Mar 1 17:16:16 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.1 Patch Level: 0 Release Status: release Description: [Detailed description of the problem, suggestion, or complaint.] Oddly, somehow, invoking ssh in a loop causes the loop to preterminate. Why? Repeat-By: [Describe the sequence of events that causes the problem to occur.] > $ #without ssh, as expected: > $ (echo a;echo b;echo c)|while read a;do ((hostname;uname -r);echo rc=$?)|while read x;do echo a=$a x=$x;done;done > a=a x=ginger > a=a x=4.18.0-240.15.1.el8_3.x86_64 > a=a x=rc=0 > a=b x=ginger > a=b x=4.18.0-240.15.1.el8_3.x86_64 > a=b x=rc=0 > a=c x=ginger > a=c x=4.18.0-240.15.1.el8_3.x86_64 > a=c x=rc=0 > $ > $ #with ssh, why does the loop preterminate? > $ (echo a;echo b;echo c)|while read a;do (ssh 192.168.96.150 "(hostname;uname -r)";echo rc=$?)|while read x;do echo a=$a x=$x;done;done > a=a x=g150 > a=a x=5.4.0-66-generic > a=a x=rc=0 > $