Why does local out=$(cmd) hide the command's exit status?
In a Bash function, I noticed that local out=$(false) reports success, but declaring out first and then assigning out=$(false) reports failure. Why are they different, and what's a…
In a Bash function, I noticed that local out=$(false) reports success, but declaring out first and then assigning out=$(false) reports failure. Why are they different, and what's a…
In Bash, printf appears to preserve field width when run directly, but the spaces seem to disappear after capturing its output with command substitution: $ printf "%-9s:" "since"…
I'm trying to capture a multi-line here-document in a Bash variable using command substitution. The backtick version works, but this version behaves unexpectedly: MYDOC=$(cat <<LIST Testing a multi-line…
I have a shell script that creates a temporary file, opens it in a new terminal with Vim, and then prints the edited contents before deleting the file.…
I've been battling a command substitution issue in my bash script that's driving me nuts! I have a binary that I need to execute, but it sometimes fails,…