mercredi 28 janvier 2015

Bash: command substitution with multiple unset/export commands


I am trying to unset some variables and export others using command substitution. This works:



$(echo "
export TEST_A=1
export TEST_B=2
")


And this too:



$(echo "
unset TEST_A
unset TEST_B
")


However, this fails with Bash 4.3.30(1)-release on both OSX and Debian Jessie:



$(echo "
unset TEST_A
export TEST_B=1
")
# bash: unset: `TEST_B=1': not a valid identifier


Is this an expected behavior, and how can one unset and export multiple variables using command substitution?


To provide some context: here is the related issue in boot2docker.



Aucun commentaire:

Enregistrer un commentaire