I have a bash script/s which has a "main" script which is run as
Variables are declared in this script.
Then it sources another
commands.sh script, however this script uses
sudo to drop back to an ordinary user when sourcing the
#!/bin/bash user=ubuntu export $user sudo -u $user bash -c "source includes-shared/commands.sh"
# debug command to see if $user is available printenv [ more commands...]
$user no longer appears in this
commands.sh script, i.e. it is not visible to
printenv or other commands.
How can I export
$user so that it is available to the sourced script?