The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-10-2002
sureshy sureshy is offline
Registered User
  
 

Join Date: Sep 2001
Location: UK
Posts: 25
my case statement doesn't work..

CO UNixware 7.1.1

Hi friends,

I have chopped my case statementt out of my .profile and put it in another script called setsid. The case statement works when run from my .profile but not from my setsid file.

All that the script does is set an environmental variable based on user input. The variable is ORACLE_SID.

Here is my script.
Code:
#! /bin/sh

echo
echo "What do you want to set your ORACLE_SID to ?
1: wmsdata
2: wmstest
3: wmsctl"
echo
read RESPONSE DUMMY

case "$RESPONSE" in
1)
  ORACLE_SID=wmsdata
  export ORACLE_SID
  alias pfile='cd $ORACLE_HOME/admin/wmsdata/pfile/'
  alias bdump='cd $ORACLE_HOME/admin/wmsdata/bdump/'
  alias udump='cd $ORACLE_HOME/admin/wmsdata/udump/'
  ;;
2)
  ORACLE_SID=wmstest
  export ORACLE_SID
  alias pfile='cd $ORACLE_HOME/admin/wmstest/pfile/'
  alias bdump='cd $ORACLE_HOME/admin/wmstest/bdump/' 
  alias udump='cd $ORACLE_HOME/admin/wmstest/udump/'
  ;;
3)
  ORACLE_SID=wmsctl
  export ORACLE_SID
  alias pfile='cd $ORACLE_HOME/admin/wmsctl/pfile/'
  alias bdump='cd $ORACLE_HOME/admin/wmsctl/bdump/'
  alias udump='cd $ORACLE_HOME/admin/wmsctl/udump/'
  ;;
*)
  ORACLE_SID=wmsdata
  export ORACLE_SID
  alias pfile='cd $ORACLE_HOME/admin/wmsdata/pfile/'
  alias bdump='cd $ORACLE_HOME/admin/wmsdata/bdump/'
  alias udump='cd $ORACLE_HOME/admin/wmsdata/udump/'
  ;;
esac
The problem is that when I run this script the ORACLE_SID stays the same and does not change.

when I set -vx I notice that th list of commands associated with the reponse do run, yet the variable does not change.


Please help.

Thanks in advance

Suresh

added code tags for readability --oombera

Last edited by oombera; 02-19-2004 at 03:29 PM..