![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Regex in if-then-else statement to match strings | rakeshou | UNIX for Dummies Questions & Answers | 7 | 04-04-2008 03:30 PM |
| case statement | bkan77 | Shell Programming and Scripting | 5 | 09-11-2007 06:54 PM |
| if statement to match * | sivasenthil_k | UNIX for Dummies Questions & Answers | 3 | 09-20-2006 12:39 PM |
| Case Statement | Zeta_Acosta | Shell Programming and Scripting | 19 | 04-06-2004 05:16 PM |
| case statement | Bab00shka | Shell Programming and Scripting | 1 | 07-15-2002 06:31 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to match the last XML extension by using Case statement
Hi All,
I have a status.txt file which contains following three files. 1.xml 2.xml 3.xml Now i have written a shell script 1.sh which contains the following cat status.txt | while read filename do echo $filename case "$filename" in xml) echo "running 1.xml" ;; esac done now when i am running the above 1.sh file then i am getting the following output. 1.xml 2.xml 3.xml But i am not getting the following output running 1.xml Can anybody told me that what is the wrong with this 1.sh code?? Should i check the /xml$/ for case statement?????? Thanks |
|
||||
|
Also lose the Useless Use of Cat. Code:
while read filename
do
echo "here $filename"
case "$filename" in
*xml)
echo "running $filename" # ... I guess you mean
;;
esac
done <status.txt
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|