On Wed, 27 Aug 2025 at 14:56, Oğuz <oguzismailuy...@gmail.com> wrote:
> I'm not against the proposed changes here but if this were me I'd store the > command output in a temporary file and inspect that instead. Unfortunately I don't think this helps all that much. It introduces hoop-jumping to use/manage the temporary files, which can't be easily hidden or made seamless/idiomatic, ie. I would still have to tell people "don't use $(), always do some_command > $tmpfile", which isn't much better than what I'm trying to avoid ("don't use $(), always use shopt -o lastpipe and do some_command | grab_output varname"). It's also counter-intuitive to read instructions which say "redirect to a file and then inspect the file is okay, but capturing output via $() and then inspecting it isn't okay". It's still awkward to inspect the $tmpfile (at least within the shell), because the natural way to do that is $(<$tmpfile)... which still eats the trailing newlines. Meaning I would be back to doing things like read -rd '', which even if hidden inside a grab_output style helper, isn't idiomatic. Lesser concerns are that it also assumes a writable $TMPDIR, and the extra filesystem involvement can affect performance. Kev