Sample Header Ad - 728x90

how to pass environment variable to sudo su

55 votes
7 answers
123958 views
I basically need to do this: DUMMY=dummy sudo su - ec2-user -c 'echo $DUMMY' This doesn't work. How can I pass the env variable $DUMMY to su? -p doesn't work with -l.
Asked by Umang (653 rep)
May 9, 2015, 06:51 AM
Last activity: Aug 5, 2024, 11:11 AM