Reputation: 187
I have been trying to setup a environment variable in Cygwin using the command export PRIMOSBASE=/directory/for/primosfiles
.
And when i check the variable using the command echo $PRIMOSBASE
it shows the /directory/for/primosfiles. hopeful this means the environment variable is set.
But when i try to run a shell script(primos) for the /directory/for/primosfiles, it shows
./primos: line 8: /prilaunch.pl: No such file or directory
chmod: failed to get attributes of `step1.sh': No such file or directory
which means i have not set the PRIMOSBASE environment. could anyone please tell me where i am going wrong...
Thanks ...
Upvotes: 0
Views: 8228
Reputation: 3286
I had a similar issue trying to get ANDROID_HOME to work in a Cygwin window. When I used the linux path separators, as follows
ANDROID_HOME=/cygdrive/c/Users/User/AppData/Local/Android/sdk
my gradlew build script complained it couldn't find the sdk in ANDROID_HOME
.
I eventually discovered that I had to set my environment variable in the Windows format, including Windows path separators '\'
, as follows
ANDROID_HOME=C:\Users\User\AppData\Local\Android\sdk
Note: the PATH and several other environment variables set in Windows are converted into Linux format. I hope this helps others who want/need to use Cygwin + Windows + essentially Windows programs that need environment variables.
Upvotes: 1
Reputation: 7579
Run
echo "export PRIMOSBASE=/directory/for/primosfiles" >> ~/.bashrc
to append the command to the end of your .bashrc
file, so that the variable is set each time you use Cygwin. Then run
source ~/.bashrc
to make it take effect immediately.
NOTE: Make sure you use double brackets (>>
) to append. It might be a good idea to make a backup of .bashrc
just in case. If you're not comfortable with I/O redirection, an alternative is to edit .bashrc
with an editor. I think vim
is among the default tools in Cygwin.
Upvotes: 1