multiple case


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting multiple case
# 1  
Old 03-13-2002
Question multiple case

hi all
im working in tcsh shell.
In sh shell i write for example:

case in $www
1 | 2 | 3)
arguments;;
4 | 5 | 6)
arguments;;
esac

can anybody tell me the equivalent to tcsh of
1 | 2 | 3)?
# 2  
Old 03-13-2002
Please see the tcsh man page. Excerpt:

Quote:
switch (string)
case str1:
...
breaksw
...
default:
...
breaksw
endsw

Each case label is successively matched, against the specified string which is
first command and filename expanded. The file metacharacters `*', `?' and
`[...]' may be used in the case labels, which are variable expanded. If none of
the labels match before a `default' label is found, then the execution begins
after the default label. Each case label and the default label must appear at
the beginning of a line. The command breaksw causes execution to continue after
the endsw. Otherwise control may fall through case labels and default labels as
in C. If no label matches and there is no default, execution continues after the
endsw.
# 3  
Old 09-17-2007
case label

If I use "?" as a case label, what does it mean?

For Example:

case $choice in
1)
.....;;
2)
.....;;
?)
.....;;
esac

Here what does "?" in case label mean?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Size of derived class, in case of multiple inheritance

Why, here the size of class 'Derived' is 8 ? class Base1 { public: virtual void f() { } }; class Base2 { public: virtual void f() { } }; class Derived : public Base1, Base2 { public: virtual void f() { } }; (1 Reply)
Discussion started by: techmonk
1 Replies

2. Shell Programming and Scripting

Choose multiple conditions in case?

Hi all, I am attempting to create a shell script to optimize some routine process. I want this script can let user select the actions they want to do. But I met a problem that my script can only read one input and then do one action. Is it possible to let my script to run more than one... (2 Replies)
Discussion started by: kaiya
2 Replies

3. Shell Programming and Scripting

multiple looping with case and funtion showing error, Please help

Hello All, I have code as follows :- while true do {opening a case1 statement} 1) {opening another case2 statement} {closing case 2} 2) Showing error for "2)" as Syntax error at line 59 : `)' is not expected. *) {closing case 1} ... (5 Replies)
Discussion started by: Renjesh
5 Replies

4. Shell Programming and Scripting

Multiple conditions in a CASE statement

is it possible to use multiple conditions in a CASE statement? And if so, what is the syntax? I'm trying to use one but can't seem to get it right. I want the statement to be CASE $vendor OR $alias condition 1) statements; condition 2) statements; etc. esac but I keep... (25 Replies)
Discussion started by: Straitsfan
25 Replies

5. Shell Programming and Scripting

Renaming multiple files, specifically changing their case

Hey all, I'm running a BASH shell and I was wondering if anyone knows a code to rename all the files in a directory. All I need to do is change the first character in the file from uppercase to lowercase and some of the files are already lowercase so they don't need to change. -Thanks (4 Replies)
Discussion started by: jjzieve
4 Replies

6. Shell Programming and Scripting

multiple lines inside a case statement

echo "please enter ur choice.. 1. Make a file. 2. Display contents 3. Copy the file 4. Rename the file 5. Delete the file 6. Exit" read choice case $choice in 1 ) echo enter the file name read fname if then echo... (2 Replies)
Discussion started by: gotam
2 Replies

7. Shell Programming and Scripting

Script needed to select and delete lower case and mixed case records

HELLO ALL, URGENTLY NEEDED A SCRIPT TO SELECT AND DELETE LOWER AND MIXED CASE RECORDS FROM A COLUMN IN A TABLE. FOR EXAMPLE : Table name is EMPLOYEE and the column name is CITY and the CITY column records will be: Newyork washington ... (1 Reply)
Discussion started by: abhilash mn
1 Replies

8. Shell Programming and Scripting

How do I make multiple connections to the server in this case

Given the following code #!/usr/bin/perl -w use IO::Socket; my($handle, $line, $kidpid); $handle = IO::Socket::INET->new( PeerAddr =>"64.22.229.139", PeerPort =>"4321", Proto=>"tcp", ... (0 Replies)
Discussion started by: frequency8
0 Replies

9. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies
Login or Register to Ask a Question