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

iiab-diagnostics: Avoid eval due to globbing "filenames that contain spaces (ugly IFS issues!)"

This commit is contained in:
root 2022-05-29 16:50:27 -04:00
parent 0654e5f6dc
commit fc50d09951

View file

@ -105,7 +105,7 @@ function cat_cmd() { # $1 = command + params, $2 = explanation
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!)
#$(echo "eval $1") >> $outfile # "eval" works with | (pipes) per https://stackoverflow.com/a/7184782 BUT globbing like 'ls -l /lib/firmware/brcm/*43455*' FAILS to output lines w/ filenames that contain spaces (ugly IFS issues!)
fi
echo >> $outfile
}