I want to pass my variable to subshell process created via -c option. I have a install.sh file in which I execute the following lines and expect the printf receives $AUTOSTART_FILE value.
AUTOSTART_FILE=/etc/xdg/lxsession/LXDE-pi/autostart
sudo sh -c 'printf "@lxpanel --profile LXDE-pi\n@/home/pi/exec.sc" > $AUTOSTART_FILE'
I read and applied this answer with no success.