! HELP ! Script : How to control parent shell ???
Dear Someone that can help,
I have a simple yet seemingly impossible issue.
I would like to export an environement variable and change the current working directory. The tough part is i need this to effect the current shell where the script was invoked. Ideally, I would like to use a bourne shell script to implement this.
I do understand the implications involved in that the shell forks a child. But there must be a way of achieving what i need.
Here is the script background :
###########################################################
User invokes from anywhere lets say for example
$Prompt > pwd ### /home/smith/
$Prompt > myproject.sh ### runs this script
#!/usr/bin/sh
echo" Please enter Project Name = \c"
read MYANSWER
MYPROJECT_NAME = "$MYANSWER"
MYPROJECT_HOME = "/project/$MYANSWER"
export MYPROJECT_NAME
export MYPROJECT_HOME
cd $MYPROJECT_HOME
back to prompt i frustratingly get
$Prompt > pwd ### /home/smith/
$Prompt > env ### does NOT contain the variables
How do i make it effect the current shell ? Can i stop it forking or can i force back something to the parent ? Anything, anyone please help !!!!
###########################################################
|