![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SAN basics | kingskar | IP Networking | 1 | 09-28-2006 06:17 AM |
| awk basics | gfhgfnhhn | Shell Programming and Scripting | 6 | 07-04-2006 03:10 AM |
| Shell basics | pradeep_desh | Shell Programming and Scripting | 3 | 06-15-2006 07:27 AM |
| character I/O basics | starless | UNIX for Dummies Questions & Answers | 8 | 12-11-2003 08:44 AM |
| UNIX Basics | paulSF | UNIX for Dummies Questions & Answers | 2 | 03-21-2002 11:45 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
basics - if condition (contains)
Can any body help me on how to check whether a file contains a required extension or not.
pseudo is: if (filename contains .jpg || filename contains .gif) --- do some thing end if Example file names: test1.grm.gtrx.drx.jpg test.de.mi.jpg test2.ds.gif test3.gif thanks in advance |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Somebody suggested in one of the messages and with that, could make it like this:
suffix=${filename##*.} if [ $suffix = "jpg" || $suffix = "gif" ]; then -- do something fi |
|
#3
|
||||
|
||||
| Google The UNIX and Linux Forums |