Look at this very basic Bash script:
#!/bin/bash
while read l
do
echo $l
echo "next one"
done <<< $(ps aux)
I have several processes on my computer, and the ps aux command works fine in the terminal.
I only get one iteration in the loop and ps command output is given on the same line. Why doesn't it work as intended?
bashv4.4) returns the same multi-line results from both the command line and as a script. Note: it'd be simpler to changewhile ... done <<< $(ps aux)tops aux | while ... done.set -ooutputs. On my systemprintf '%x\n' $((2#$(set -o | rev | cut -c 1 | tr 'fn' '01' | tr -d '\n')))outputs the hex summary of 31d4000. (That is it takes a list of "on/off" values, converts 'em to binary, then to a single hex value.)