![]() |
|
|
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 |
| Help--Using wildcards in string comparison | deepae | Shell Programming and Scripting | 2 | 05-06-2009 02:01 PM |
| Find the position of a string and replace with another string | bab123 | Shell Programming and Scripting | 6 | 01-21-2009 04:14 AM |
| Read a string with leading spaces and find the length of the string | dayamatrix | UNIX for Dummies Questions & Answers | 2 | 11-13-2008 10:08 AM |
| counting a list of string in a list of txt files | Pep Puigvert | UNIX for Dummies Questions & Answers | 4 | 08-15-2008 04:55 PM |
| command find returned bash: /usr/bin/find: Argument list too long | yacsil | Shell Programming and Scripting | 1 | 12-15-2003 06:38 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Find string in list with wildcards
I need to add code to a shell script to find out if a string matches any item in a list, where the list can contain a wildcard character.
For example, if I have the following list: ok_versions="03-02-4, 04-01-*" Then I want to compare a particular string to see if it matches any item in the list. For example, I could have a string like the following my_version="04-01-2". I want to check my_version against ok_versions, and note that my_version is ok if it is 03-02-4, 04-01-1, 04-01-2, etc., but that it is not ok if it doesn't match one of the patterns. The ok_versions list could have any number of entries (not just two). I am new to shell scripting and would really appreciate anyone who can solve this problem for me. Thanks! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|