Sponsored Content
Top Forums UNIX for Dummies Questions & Answers my case statement doesn't work.. Post 24317 by sureshy on Wednesday 10th of July 2002 06:07:32 AM
Old 07-10-2002
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..
 

10 More Discussions You Might Find Interesting

1. Programming

why doesn't this work?????

i keep getting the following error with the code segment below when i try to compile the program. parse error before '(' parse error before ')' stray '\' in program this is the code segment and the error is on the second line of the segment #define DEBUG(fmt) if(traceflag) {... (1 Reply)
Discussion started by: token
1 Replies

2. Windows & DOS: Issues & Discussions

[help]Win98 doesn't respond

My system is combined by Win98 and sco opensever.......but when Win98 is starting .my computer doesn't respond........what can i do? (1 Reply)
Discussion started by: dingxf
1 Replies

3. UNIX for Dummies Questions & Answers

Repquota doesn't work as Cronjob?!?

Hello: I'm trying to run repquota -ag > /home/usersdir/repquota.txt as a daily cronjob at midnight, but the file always ends up blank. I even tried writing a quick Perl script to e-mail me what running that command outputs, and it's nothing. Can root run repquota as a cronjob? Do I have... (1 Reply)
Discussion started by: b416
1 Replies

4. Shell Programming and Scripting

grep doesn't work within shell script?

I am trying to run the following code from a script file but it complains that syntax of (both instances of) grep is wrong. When I copy and paste it to the terminal, it is OK. Any idea what the problem might be? set i = `grep -c #define flags.h` while ($i>20) @ i-- my func (`cat... (4 Replies)
Discussion started by: barisgultekin
4 Replies

5. UNIX for Dummies Questions & Answers

unmount doesn't work

Hi guys, I've been trying to unmount a floppy like this: unmount /mnt/floppy But then I get a "command not found" message."mount" works,but why not unmount? I've also tried "eject" but all it does is open up my cdrom drive and I tried "eject /mnt/floppy" but I get an error that says Invalid... (2 Replies)
Discussion started by: DISTURBED
2 Replies

6. Shell Programming and Scripting

my "case" doesn't work !

I'm using the case statement in the following script and it always takes the "*" default choice while it should be "3". I wonder why ??? dt_auj=`date +%d` NBLOG=`ls -al /users/notes01/LOG/t*|awk '{print $7}'|grep $dt_auj|wc -l` case $NBLOG in 1) cat ~/LOG/console-notes > $fic_tmp1 ;; 2)... (5 Replies)
Discussion started by: Nicol
5 Replies

7. UNIX for Dummies Questions & Answers

Script doesn't work, but commands inside work

Howdie everyone... I have a shell script RemoveFiles.sh Inside this file, it only has two commands as below: rm -f ../../reportToday/temp/* rm -f ../../report/* My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies

8. Ubuntu

set completion-ignore-case on doesn't work in bash

completion-ignore-case option doesn't work in my version: /home/user $ echo $BASH_VERSION 3.2.48(1)-release /home/user $ ls -l * -rw-r--r-- 1 user user 0 2009-10-18 00:09 somefile -rw-r--r-- 1 user user 0 2009-10-18 00:09 Somefile /home/user $ set completion-ignore-case on But when I... (2 Replies)
Discussion started by: Sapfeer
2 Replies

9. Shell Programming and Scripting

My if statement doesn't work why?

I have the following and for some reason I can't have two options together. I mean if I choose -u and -p it won't work... why? #!/bin/bash resetTime=1 mytotalTime=0 totalHour=0 totalMin=0 averagemem=0 finalaverage=0 times=0 function usage() { cat << EOF USAGE: $0 file EOF } (10 Replies)
Discussion started by: bashily
10 Replies

10. Shell Programming and Scripting

How come this if statement doesn't work?

greetings, the following code isn't working as i expect it to. the first dbl brackets do but the second set gets ignored. ie: if i'm on t70c6n229 it echoes "Something" and i expect it not to. what am i missing? if " ]] || " ]]; then echo "Something" fi thanx! (9 Replies)
Discussion started by: crimso
9 Replies
setsid(2)							System Calls Manual							 setsid(2)

NAME
setsid - Sets the process group ID SYNOPSIS
#include <unistd.h> pid_t setsid( void ); Application developers may want to specify an #include statement for <sys/types.h> before the one for <unistd.h> if programs are being developed for multiple platforms. The additional #include statement is not required on Tru64 UNIX systems or by ISO or X/Open standards, but may be required on other vendors' systems that conform to these standards. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: setsid(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. DESCRIPTION
The setsid() function creates a new session when the calling process is not a process group leader. The calling process then becomes the session leader of this session, becomes the process leader of the new process group, and has no controlling terminal. The process group ID of the calling process is set equal to its process ID. The calling process becomes the only process in the new process group and the only process in the new session. RETURN VALUES
Upon successful completion, the setsid function returns the value of the new process group ID. Otherwise, a value of (pid_t)-1 is returned and errno is set to indicate the error. ERRORS
The setsid() function sets errno to the specified values for the following conditions: The calling process is already the process group leader, or the process group ID of another process matches the process ID of the calling process. RELATED INFORMATION
Functions: getpid(2), getsid(2), setpgid(2) Standards: standards(5) delim off setsid(2)
All times are GMT -4. The time now is 10:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy