Sponsored Content
Top Forums Shell Programming and Scripting How to make sure the input string is one of many options? Post 302580227 by honglus on Thursday 8th of December 2011 01:39:10 AM
Old 12-08-2011
I found this "if condition check" satisfy my need.

@(pattern-list)
Matches one of the given patterns
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scripts that take String options

I need help to know how to create a script that takes string options and not only 1 charecter. I wanted to make a script that takes 'string' options eg. hscript.sh -product XXX -version XXX I know that I can make a script that takes "1 Charecter " options eg. hscript.sh -m XXX -l XXX -s XXX ,... (2 Replies)
Discussion started by: hanhanbib
2 Replies

2. UNIX for Dummies Questions & Answers

Installing Apache with make options

I am installing apache on freebsd and the screen comes up with make options. Here I would like to deselect DAV and DAV_FS. How can this be done on the command line in order to achieve a silent install? This is what I have currently, but the installation script still enters the menu with the make... (2 Replies)
Discussion started by: figaro
2 Replies

3. BSD

Make options for wget

I mam trying to install wget from the command line without user intervention. So I devised something as follows: cd /usr/ports/ftp/wget make -DWITHOUT_GNUTLS=yes -DWITHOUT_IPV6=no -DWITHOUT_NLS=no -DWITHOUT_OPENSSL=no However, this will still get me into the screen where user input is required.... (4 Replies)
Discussion started by: figaro
4 Replies

4. Shell Programming and Scripting

make a variable read the value from the standard input

Hi, In Perl, how can we define a variable make it read the value from the standard input? Meaning, how can have the user type in the value that will be assigned to the variable? Thanks, (2 Replies)
Discussion started by: Pouchie1
2 Replies

5. Shell Programming and Scripting

Grep a string from input file and delete next three lines including the line contains string in xml

Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies

6. Shell Programming and Scripting

make loop from input file

Hi Guys, I have file A.txt PP97 PP66 PP87 PP66 PP47 PP57 PP44 PP20 PP66 PP16 PP13 PP51 PP68 PP70 PP75 PP30 (2 Replies)
Discussion started by: asavaliya
2 Replies

7. Shell Programming and Scripting

How do i make input start with a letter?

Howdy folks, How do i make the input start with a letter and certain num of numbers and if anything else is entered it should display error for ex; a123455 is good ( exactly 7 characters) and ex: sio234234 is not good ex: b233 is not good.. ex: jlasjdlfks is not good ... (2 Replies)
Discussion started by: coolkid
2 Replies

8. Shell Programming and Scripting

Input two password(pass1/pass2) options for single node..

Hi Team, i want to input two password for single node like pass1/pass2 one of the pass1 is working some node and pass2 is working for some nodes . For nodes having pass1 i have to run diffrent script and for nodess having pass2 i have to run diffrent script Sooo how can put two pass... (1 Reply)
Discussion started by: Ganesh Mankar
1 Replies

9. UNIX for Beginners Questions & Answers

Search a string and display its location on the entire string and make a text file

I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file. Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies

10. Shell Programming and Scripting

Insert a user input string after matched string in file

i am having file like this #!/bin/bash read -p 'Username: ' uservar match='<color="red" />' text='this is only a test so please be patient <color="red" />' echo "$text" | sed "s/$match/&$uservar\g" so desireble output what i want is if user type MARIA this is only a test so please... (13 Replies)
Discussion started by: tomislav91
13 Replies
FNMATCH(3)						     Linux Programmer's Manual							FNMATCH(3)

NAME
fnmatch - match filename or pathname SYNOPSIS
#include <fnmatch.h> int fnmatch(const char *pattern, const char *string, int flags); DESCRIPTION
The fnmatch() function checks whether the string argument matches the pattern argument, which is a shell wildcard pattern. The flags argument modifies the behavior; it is the bitwise OR of zero or more of the following flags: FNM_NOESCAPE If this flag is set, treat backslash as an ordinary character, instead of an escape character. FNM_PATHNAME If this flag is set, match a slash in string only with a slash in pattern and not by an asterisk (*) or a question mark (?) metacharacter, nor by a bracket expression ([]) containing a slash. FNM_PERIOD If this flag is set, a leading period in string has to be matched exactly by a period in pattern. A period is considered to be leading if it is the first character in string, or if both FNM_PATHNAME is set and the period immediately follows a slash. FNM_FILE_NAME This is a GNU synonym for FNM_PATHNAME. FNM_LEADING_DIR If this flag (a GNU extension) is set, the pattern is considered to be matched if it matches an initial segment of string which is followed by a slash. This flag is mainly for the internal use of glibc and is implemented only in certain cases. FNM_CASEFOLD If this flag (a GNU extension) is set, the pattern is matched case-insensitively. FNM_EXTMATCH If this flag (a GNU extension) is set, extended patterns are supported, as introduced by 'ksh' and now supported by other shells. The extended format is as follows, with pattern-list being a '|' separated list of patterns. '?(pattern-list)' The pattern matches if zero or one occurrences of any of the patterns in the pattern-list match the input string. '*(pattern-list)' The pattern matches if zero or more occurrences of any of the patterns in the pattern-list match the input string. '+(pattern-list)' The pattern matches if one or more occurrences of any of the patterns in the pattern-list match the input string. '@(pattern-list)' The pattern matches if exactly one occurrence of any of the patterns in the pattern-list match the input string. '!(pattern-list)' The pattern matches if the input string cannot be matched with any of the patterns in the pattern-list. RETURN VALUE
Zero if string matches pattern, FNM_NOMATCH if there is no match or another nonzero value if there is an error. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+--------------------+ |Interface | Attribute | Value | +----------+---------------+--------------------+ |fnmatch() | Thread safety | MT-Safe env locale | +----------+---------------+--------------------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008, POSIX.2. The FNM_FILE_NAME, FNM_LEADING_DIR, and FNM_CASEFOLD flags are GNU extensions. SEE ALSO
sh(1), glob(3), scandir(3), wordexp(3), glob(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2015-12-28 FNMATCH(3)
All times are GMT -4. The time now is 12:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy