shellcheck gives me the following warning:
In myscript line 38:
echo -e "blah/blah\n$(cat ${tmpdir}/${filename}.jpdf)" > "$tmpdir"/"$filename".jpdf
^-- SC2086: Double quote to prevent globbing and word splitting.
The command in question is intended to insert a line at the beginning of a file ${tmpdir}/${filename}.jpdf
.
Does the warning by shellcheck make sense? Why?
I have already double quote the entire argument to echo -e
, and should I further double quote ${tmpdir}
and ${filename}
?
Thanks.
bash
matched (paired)? – Weijun Zhou Feb 04 '18 at 03:14$(...)
introduces a subshell and in that subshell variables still need to be quoted. – glenn jackman Feb 04 '18 at 12:14