should work now, if the reference sites are right about the variable for non-interactive. the var was not passed in before since sudo is not like a sub-shell. now the two pieces needed, setting the var and running command that listens to var, are done in a single multi-line bash command.