LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 09-19-2005, 06:02 PM   #1
Gald3r
LQ Newbie
 
Registered: Sep 2005
Location: Athens, Greece
Distribution: RedHat 9
Posts: 24

Rep: Reputation: 15
Exclamation Problem in case command - RH9


Another problem I face in Redhat Linux 9 shell scripting is when I use the case command. In the following example I want to write a script that identifies the first letter of an argument and informs the user about that. That is :
#!/bin/sh
case $1 in
[A-Z]*) #error
echo "starts with capital"
[a-z]*) #error
echo "starts with non-capital"
esac
However, when i try to run this script i get an error message in the lines I have noticed. I think that the rest of the code is correct. Can you please help?

 
Old 09-19-2005, 07:52 PM   #2
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
Re: Problem in case command - RH9

Quote:
Originally posted by Gald3r
Another problem I face in Redhat Linux 9 shell scripting is when I use the case command. In the following example I want to write a script that identifies the first letter of an argument and informs the user about that. That is :
#!/bin/sh
case $1 in
[A-Z]*) #error
echo "starts with capital"
[a-z]*) #error
echo "starts with non-capital"
esac
However, when i try to run this script i get an error message in the lines I have noticed. I think that the rest of the code is correct. Can you please help?

of course, this is wrong.
try this one:
Code:
#!/bin/sh
case $1 in
 [A-Z]*)
   echo "starts with capital";;
 [a-z]*)
   echo "starts with non-capital";;
esac

Last edited by perfect_circle; 09-19-2005 at 07:53 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any arguement that can be used with 'ls' command to ignore case? davidas Linux - Newbie 5 02-26-2006 05:46 AM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 05:09 PM
case insensitive search command ColKurtz Linux - Newbie 4 01-20-2005 08:02 AM
Activating case sensitivity in `sort' command? wirawan0 Linux - General 4 06-26-2004 11:20 AM
makeing Find command not case sensitive? -ilname isnt working. systemgsr Linux - General 2 12-25-2001 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 11:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration