At 11:18 -0700 05 Apr 2026, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
On 2026-04-05 10:39, Mark J. Reed wrote:So if 'ls' is called within a function that counts as 'not a terminal'? Man ... so easy to draw the wrong conclusion. As above, I thought it was the array causing that.If its output is not going to a terminal, you get the "polite" behavior that outputs one filename per line. Any time you're doing `ls |` or `$(ls)` or `<(ls)`, the output is not going to a terminal, so you get the one-per-line behavior.
No. Unless the function definition directs the output elsewhere, the output of ls (or any other command) in a function goes wherever the output of the function goes.
If you're starting from a terminal there can be essentially unlimited levels of scripts or other commands, aliases, or functions between the terminal and the ls execution with the output still going to a terminal as long as nothing directed the output to go somewhere else.