What does declare +x do below? (Specific to Bash.) I understand declare -x, but not declare +x:
function the_func { declare +x MY_VAR="new value" child-process } export MY_VAR="original" the_func With
declare -x MY_VAR="new value" you export variable MY_VAR into the environment, whereas with
declare +x MY_VAR="new value" you remove that variable from the environment.
Generally speaking, for the declare command, using + undoes the action done by -.
More info can be found here
declare -x is not same as export, if you call it inside fuction declare -x will export it only within scope of function, where export do export into environment OS
help declare