Sponsored Content
Full Discussion: can you switch
Top Forums Shell Programming and Scripting can you switch Post 11286 by rwb1959 on Saturday 1st of December 2001 02:24:20 PM
Old 12-01-2001
Personally, I would stay away from csh but...

In csh, the "switch" is used...

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


In your script:

...
read choice
switch ($choice)
case 1:
sar -p
breaksw
case 2:
sar -u
breaksw
case 3:
diskusage -p
breaksw
case 9:
breaksw
default:
echo 'Invalid choice'
breaksw
endsw
...

The numbers in the case lines may have to be
strings like: case "1":
Since I haven't use csh in many years, I don't
recall exactly.
 

9 More Discussions You Might Find Interesting

1. Programming

Switch

using switch can we match for more than one values.. eg: switcha(a) { case 1, 2, 3: printf("ddd"); break; case 4, 5, 6: printf("mmm"); break; } In this case wat i found was only for the last value, i.e 3 and 6 the switch works. ... (12 Replies)
Discussion started by: abey
12 Replies

2. Shell Programming and Scripting

script with more then one switch

Hi, have managed to code a script that has a simple menu so for instance if I run: this will call a help function that displays the programs help, I have coded this in using a case statement so if: case is h) call the help function The problem is I don't know how to code in the... (3 Replies)
Discussion started by: Del33t
3 Replies

3. UNIX for Advanced & Expert Users

switch login

Hi, How can I switch from one login to another login in UNIX. su command is disabled in my environment. Is there any alternate way to login. (1 Reply)
Discussion started by: sharif
1 Replies

4. Shell Programming and Scripting

Switch + stirng

Hi, This script receive in input 2 parameters, the use $2 in this way: switch ($2) case r: p=r-- echo $2 ok breaksw case rw: p=rw- echo $2 ok breaksw case rwx: p=rwx echo $2 ok breaksw default... (5 Replies)
Discussion started by: DNAx86
5 Replies

5. UNIX for Advanced & Expert Users

Accessing switch

Hello Community! Anyone knows how can I access the switch for monitoring the traffic on my LAN? The switch is a Linksys sr2024 Thanks in advance (1 Reply)
Discussion started by: ncatdesigner
1 Replies

6. Shell Programming and Scripting

need help for cp with -p switch

Guys, I need to copy files from source to destination with datetime preserved I did it with cp -p <source>/file <destinaltion>/file But when I do stat command on copied file , it seems the copied file has "change time" modified. Please guide me in understanding (2 Replies)
Discussion started by: mohan_xunil
2 Replies

7. Shell Programming and Scripting

how to access console of a switch having rj45 on switch side to db 9 female on pc side console cable

hi, how to access console of a switch having rj45 on switch side to db 9 female on pc side console cable which needs to be connected to one console server having rj11 on its side and db 9 female on other end.i.e. on switch side,console cable has rj45 and db 9 pin female connector on other side of... (1 Reply)
Discussion started by: pankajd
1 Replies

8. UNIX for Dummies Questions & Answers

Tar with -T switch

Howdy, I'm trying to tar a bunch of files into their own individual tar archives. In other words i have files a.txt thru z.txt and i want to create a.tar thru z.tar in the same folder. I've been using -T to read in the list of files to be archived but i can't get it to work. I think my problem is... (5 Replies)
Discussion started by: fistikuffs
5 Replies

9. Solaris

Switch to su

Hi, I've put the correct root password but why do I get this below? huamin@SOL11I:~$ su Password: su: Sorry huamin@SOL11I:~$ Many Thanks & Best Regards, HuaMin (16 Replies)
Discussion started by: HuaMin
16 Replies
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh. Note that /etc/shells overrides the default list. Invalid shells in /etc/shells may cause unexpected behavior (such as being unable to log in by way of ftp(1)). FILES
/etc/shells lists shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.10 4 Jun 2001 shells(4)
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy