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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sh -help with case statement (should be simple) kuliksco Shell Programming and Scripting 1 11-19-2007 10:04 PM
case statement bkan77 Shell Programming and Scripting 5 09-11-2007 05:54 PM
Case statement problem gzs553 UNIX for Advanced & Expert Users 6 11-14-2006 04:24 PM
turning case into a if statement brentdeback Shell Programming and Scripting 2 12-03-2005 12:12 AM
Case Statement Zeta_Acosta Shell Programming and Scripting 19 04-06-2004 04:16 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-12-2002
Bab00shka Bab00shka is offline
Registered User
  
 

Join Date: Apr 2002
Location: Chesterfield, UK
Posts: 123
case statement

Hi all,

is it possible to create a 'dynamic' case statement.

ie

select option in `ls`
do
case satement depending on results of the above `ls`
done

I hope I have explained this ok!

Thanks
Helen
  #2 (permalink)  
Old 07-15-2002
Kevin Pryke Kevin Pryke is offline
Registered User
  
 

Join Date: Feb 2002
Location: Bradford, UK
Posts: 70
You can do (for example)

# !/bin/sh
for option in `ls`
do
case "$option" in
file1) echo "found file1" ;;

*) echo "." ;;
esac
done
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0