![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pstat_getdisk() call doesn’t work properly in HPUX 11.31 (11i V3) | sandiworld | HP-UX | 2 | 10-25-2007 10:39 AM |
| unmount doesn't work | DISTURBED | UNIX for Dummies Questions & Answers | 2 | 07-04-2002 06:14 PM |
| grep doesn't work within shell script? | barisgultekin | Shell Programming and Scripting | 4 | 05-24-2002 02:01 PM |
| Repquota doesn't work as Cronjob?!? | b416 | UNIX for Dummies Questions & Answers | 1 | 04-14-2002 08:44 PM |
| why doesn't this work????? | token | High Level Programming | 1 | 09-20-2001 10:08 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 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.. |
|
||||
|
I am new to unix, but i think i can give you a small tip, sometimes tips from stupids makes great history.. LOL
I think that the variable you are setting in your script, is only available for the shell your script is creating, in order to make it available for other shells, I am not sure, but i think you can use EXPORT {variable name} at the end of the script. |
|
||||
|
. ./.profile
I have a similar problem, mine is AIX w/ksh.
I want to be able to 'restart' my login without have to type 'login' to exit and relogin completely to get my .profile to be invoked again. If I typed, from my $HOME directory, ". ./.profile" (without the quotes of course), the environment variables I set all take effect. However, if I put this command ". ./.profile" in a file call "restart". It doesn't seem to do anything...I am still pointing to the database I first logged in with and the old variables still exist...Here's my restart script..simple enuff: restart: #!/bin/ksh . ./.profile .profile: . $HOME/.promptuser .promptuser: export variable1... export variable2... etc. Please advise how I can get the "restart" script to export new sets of variables again..right now, it executes and I get the prompt again to pick a database, but regardless of what choice I pick, it still points me back to whatever choice I picked when I first logged in to the server. Okay, so I am too lazy to type . ./.profile or . $HOME/.profile from the $HOME directory... and want to be able to switch databases on the fly from anywhere that's why I am asking...thanx. It works but it doesn't work. Gianni |
|
|||||
|
I believe your problem is that you are running a script and again starting another child process which means the parent does not have any changes.
Try setting up an alias for . ./.profile as follows: $ alias redo='. ~/restart' or even better $ alias redo='. ~/.profile' Then if you type in redo, you should get your change. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|