I am trying to launch an application that needs many switches in order to operate so I have multi lined them using the \
operator. Now I need to run this application as well as some exports to be ran as another user.
What I am currently attempting to do is
sudo -u user bash <<EOF
export AUDIO_DRV=alsa
export ...
exec application --switch1 \
--switch2 \
--switch3 \
--switch4 \
... \
"$@"
EOF
I would run sudo myscript.sh
so that root may setup a few things before it drops privileges to run the main application. The problem is that the multi line switches are not all being passed to the application causing unexpected results.
Is there any way to make this work as clean as this would of been or am I stuck appending all the switches to one line in order for it to work?