How to intialize a variable from another script in bash?
Posted
by Zombies
on Stack Overflow
See other posts from Stack Overflow
or by Zombies
Published on 2010-05-09T23:00:40Z
Indexed on
2010/05/09
23:08 UTC
Read the original article
Hit count: 185
bash
How can I set my intial variables in a re-usable way? I tried to do this by invoking something like this in my child script:
./init.bash
And inside init.bash:
prod="false"
if [ "$prod" == "prod" ]
then
RUN_DIR=/home/windsor/.scripts/websites
JAVA_DIR=/home/windsor/prog/websitechecker
OUT_DIR=/tmp/
DB="prod"
else
if [ ! -a /tmp/test ]
then
mkdir /tmp/test
fi
DB="mydb"
OUT_DIR=/tmp/test/
RUN_DIR=/home/windsor/workspaces/bash/websites
JAVA_DIR=/home/windsor/workspaces/java/testrun
fi
cd $RUN_DIR
© Stack Overflow or respective owner