1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

iiab-diagnostics: bash -c "$1" instead of eval/exec to fix globbing

This commit is contained in:
root 2022-05-29 16:37:45 -04:00
parent 61ada786cd
commit 0654e5f6dc
2 changed files with 5 additions and 2 deletions

View file

@ -102,7 +102,10 @@ function cat_cmd() { # $1 = command + params, $2 = explanation
if [[ $pthcmd == "" ]]; then
echo "COMMAND NOT FOUND: $1" >> $outfile
else
$(echo "eval $1") >> $outfile # eval is nec within backticks, so | (pipes) work: https://stackoverflow.com/a/7184782
bash -c "$1" >> $outfile # Works with | (pipes) and 'ls -l /lib/firmware/brcm/*43455*' etc!
#(exec $1 >> $outfile) # Works with | (pipes) and 'ls -l /lib/firmware/brcm/*43455*' etc! Subshell needed (parens) as exec then exits entire shell.
#eval $1 >> $outfile # Should be identical to below, i.e. insufficient -- "eval" combine ARGs into a single string.
#$(echo "eval $1") >> $outfile # "eval" works with | (pipes) per https://stackoverflow.com/a/7184782 BUT commands like 'ls -l /lib/firmware/brcm/*43455*' FAIL to output lines w/ filenames that contains spaces (ugly IFS issues!)
fi
echo >> $outfile
}

View file

@ -62,4 +62,4 @@ But first off, the file is compiled by harvesting 1 + 6 kinds of things:
## Source Code
Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 110-233 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible.
Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 119-243 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible.