SC2163: Exporting an expansion rather than a variable.

export takes a variable name, but shellcheck has noticed that you give
it an expanded variable instead. The problematic code does not export
MYVAR but a variable called foo if any.

Add exception when using indirections where the variable to extract is
actually the value of the variable.

PR:		227109
Submitted by:	mat
Sponsored by:	Absolight
This commit is contained in:
Mathieu Arnold 2018-06-01 16:20:39 +00:00
parent c9551e33bb
commit 267d5b45d4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=471269

View file

@ -197,6 +197,8 @@ export_ports_env() {
value="$(eval echo \$${var})"
if [ -n "${value}" ]; then
# shellcheck disable=SC2163
# We want to export the variable which name is in var.
export ${var}
echo "export ${var}=\"${value}\""
fi