I’m running a script that does fine by itself, but stops when piped through less (or other program that grabs the tty). I’ve boiled it down to this snippet:
$ env -i TERM=vt100 bash --norc --noprofile
bash-3.2$ echo `uname;date` | less -EX
[2]+ Stopped echo `uname;date` | less -EX
bash-3.2$ fg
echo `uname;date` | less -EX
Darwin Mon Dec 12 13:44:02 PST 2022
The same command runs without problems on Linux. It also runs fine if I put it until a subshell:
bash-3.2$ (echo `uname;date;`) | less -EX
Darwin Mon Dec 12 13:46:34 PST 2022
I can use the subshell as a workaround in my real program, but it’s weird. Any suggestions what is going on?
System info:
bash-3.2$ uname -rms
Darwin 21.6.0 x86_64