Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script problems-how do i get back to the script

Status
Not open for further replies.

maxcrook

Programmer
Jan 25, 2001
210
GB
I have a script when running gives you menu option with an option to set a persona.
The script should set the persona and return to the menu to enable the user to run tasks under the persona. However when the option is taken the command line is returned (not the menu) When i type exit the next stage of the script is started but the persona is no longer set !
Heres what i have:
echo Setting environment Please Wait
fraudoffice setcs +Telewest1_6
echo ""
echo &quot;\n Press <ENTER> to continue&quot;;echo;echo
read prompt
$FMS_HOME/FMS_STOP_PROCESS_MENU.sh
 
When you set any variables in a script, they are local to that script, unless &quot;export&quot;-ed. However, even if they are &quot;export&quot;-ed, they cannot be passed backup &quot;up&quot; to the parent process.

Run your &quot;Environment set script&quot; with a &quot;. &quot; [That is a dot-space] in front of it. This specifies to run it in the current shell. something like below should be a start toward perfecting the functionality. The &quot;fraudoffice&quot; script should &quot;export&quot; all variables in order for this to function properly.

An alternative to this would be to create a new menu script that contains 2 (or more) &quot;functions&quot;, or to move your environment setting script into the $FMS_HOME/FMS_STOP_PROCESS_MENU.sh program.

Then all variables are kept intact because that are running in the same script.

echo Setting environment Please Wait
. fraudoffice setcs +Telewest1_6 # The &quot;. &quot; says to run in the current shell
echo &quot;&quot;
echo &quot;\n Press <ENTER> to continue&quot;;echo;echo
read prompt
$FMS_HOME/FMS_STOP_PROCESS_MENU.sh
 
I put a &quot;. &quot; in front of fraudoffice setcs +Telewest1_6 but the script still returns the command line instead of following through to the echo commands to enable the user to return to the menu.
I also created a separate script that the menu option called that ran the process as suggested with a &quot;. &quot; but that did not work either.




 
The easiest thing to do would be to combine both scripts into one.

Bill.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top