13

I'm trying to set environment variable through a shell script. Here is the script with various techniques:

#!/bin/sh
echo "export SOMEPATH=/root/some" >> /root/.bash_profile
echo "export PATH=$PATH:$SOMEPATH/bin" >> /root/.bash_profile
SOMEPATH=/root/some
export SOMEPATH
source /root/.bash_profile

I run the script a.sh with sh a.sh

Then if I check the env variable it doesn't show up.

echo $SOMEPATH returns nothing. I expected to get SOMEPATH returned

0

0

Browse other questions tagged .