Unix and Linux Discussions Tagged with slash |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
2 |
1,946 |
Shell Programming and Scripting |
|
|
|
2 |
7,623 |
Shell Programming and Scripting |
|
|
|
5 |
10,002 |
Shell Programming and Scripting |
|
|
|
2 |
3,512 |
Shell Programming and Scripting |
|
|
|
7 |
51,251 |
Shell Programming and Scripting |
|
|
|
1 |
25,834 |
Shell Programming and Scripting |
|
|
|
3 |
6,233 |
Shell Programming and Scripting |
|
|
|
1 |
10,032 |
Shell Programming and Scripting |
|
|
|
6 |
18,550 |
Shell Programming and Scripting |
|
|
|
0 |
979 |
Software Releases - RSS News |
|
|
|
3 |
34,519 |
Shell Programming and Scripting |
|
|
|
2 |
35,687 |
Shell Programming and Scripting |
|
|
|
3 |
4,880 |
UNIX for Advanced & Expert Users |
|
|
|
1 |
3,374 |
Programming |
|
|
|
1 |
5,356 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
5,601 |
UNIX for Dummies Questions & Answers |
SHELLEXP(3) Library Functions Manual SHELLEXP(3)
NAME
shellexp - match string against a cruft filter pattern
SYNOPSIS
extern int shellexp(const char *string, const char *pattern);
DESCRIPTION
The shellexp() function is similar to fnmatch(3), but works with cruft patterns instead of standard glob(7) patterns. The function returns
a true value if string matches the cruft pattern pattern, and a false value (0) otherwise. Returns -1 in case of pattern syntax error.
Cruft patterns are similar to glob(7) patterns, but are not fully compatible. The following special characters are supported:
? (a question mark)
matches exacly one character of string other than a slash.
* matches zero or more characters of string other than a slash.
/** or /**/
matches zero or more path components in string. Please note that you can only use ** when directly following a slash, and further-
more, only when either directly preceding a slash or at the very end of pattern. A ** followed by anything other than a slash makes
pattern invalid. A ** following anything else than a slash reduces it to having the same effect as *.
[character-class]
Matches any character between the brackets exactly once. Named character classes are NOT supported. If the first character of the
class is ! or ^, then the meaning is inverted (matches any character NOT listed between the brackets). If you want to specify a
literal closing bracket in the class, then specify it as the first (or second, if you want to negate) character after the opening
bracket. Also, simple ASCII-order ranges are supported using a dash character (see examples section).
Any other character matches itself.
EXAMPLES
/a/b*/*c
matches /a/b/xyz.c, as well as /a/bcd/.c, but not /a/b/c/d.c.
/a/**/*.c
matches all of the following: /a/a.c, /a/b/a.c, /a/b/c/a.c and /a/b/c/d/a.c.
/a/[0-9][^0-9]*
matches /a/1abc, but not /a/12bc.
BUGS
Uses constant-length 1000 byte buffers to hold filenames. Also uses recursive function calls, which are not very efficient. Does not vali-
date the pattern before matching, so any pattern errors (unbalanced brackets or misplaced **) are only reported when and if the matching
algorithm reaches them.
SEE ALSO
fnmatch(3), glob(3), cruft(8) and dash-search(1).
AUTHOR
This manual page was written by Marcin Owsiany <porridge@debian.org>, for the Debian GNU/Linux system (but may be used by others).
October 17, 2007 SHELLEXP(3)