mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Add support for ** in the patterns
This commit is contained in:
parent
36cef9ee89
commit
9f14dd94e5
55 changed files with 2274 additions and 1325 deletions
2
HISTORY
2
HISTORY
|
|
@ -7,6 +7,8 @@ SnapRAID HISTORY
|
|||
directly within the array directory tree. This allows for granular,
|
||||
directory-level control over which files and folders are excluded from
|
||||
parity, mirroring the workflow of .gitignore.
|
||||
* Added support for the ** globbing character to allow recursive pattern
|
||||
matching across multiple directory levels.
|
||||
* Added detection of the smartctl executable. Improves reliability when running
|
||||
under sudo or in environments where /sbin and /usr/sbin are not in PATH.
|
||||
* Avoided saving the content file when it was not strictly necessary.
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ snapraid_SOURCES = \
|
|||
cmdline/handle.c \
|
||||
cmdline/touch.c \
|
||||
cmdline/device.c \
|
||||
cmdline/fnmatch.c \
|
||||
cmdline/selftest.c \
|
||||
cmdline/speed.c \
|
||||
cmdline/import.c \
|
||||
|
|
@ -97,7 +96,6 @@ noinst_HEADERS = \
|
|||
cmdline/metrotest.c \
|
||||
cmdline/museair.c \
|
||||
cmdline/museairtest.c \
|
||||
cmdline/fnmatch.h \
|
||||
cmdline/import.h \
|
||||
cmdline/search.h \
|
||||
cmdline/thermal.h \
|
||||
|
|
@ -458,12 +456,11 @@ endif
|
|||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) -d disk1 check > output.log
|
||||
if HAVE_POSIX
|
||||
# Only in real unix, as with MingW the * trigger path replacement
|
||||
# Like /b/a* -> B:/a* and SnapRAID then complain about relative paths
|
||||
# Like /b/a* -> B:/a* and SnapRAID then complain
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) -f \\*a -f a/ -f /b/a\\* check > output.log
|
||||
endif
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) --test-expect-failure -f . check > output.log
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) --test-expect-failure -f ./ check > output.log
|
||||
$(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(CONF) --test-expect-failure -f a/a check > output.log
|
||||
$(MSG) Delete some files and sync
|
||||
rm bench/disk4/a/9*
|
||||
rm bench/disk5/a/9*
|
||||
|
|
|
|||
109
cmdline/elem.c
109
cmdline/elem.c
|
|
@ -96,27 +96,23 @@ struct snapraid_filter* filter_alloc_file(int direction, const char* root, const
|
|||
|
||||
if (first == 0) {
|
||||
/* no slash */
|
||||
filter->is_path = 0;
|
||||
filter->is_abs = 0;
|
||||
filter->is_dir = 0;
|
||||
} else if (first == last && last[1] == 0) {
|
||||
/* one slash at the end */
|
||||
filter->is_path = 0;
|
||||
filter->is_dir = 1;
|
||||
last[0] = 0;
|
||||
} else {
|
||||
/* at least a slash not at the end */
|
||||
filter->is_path = 1;
|
||||
if (last[1] == 0) {
|
||||
filter->is_dir = 1;
|
||||
last[0] = 0;
|
||||
if (first == filter->pattern) {
|
||||
/* slash at the start */
|
||||
filter->is_abs = 1;
|
||||
} else {
|
||||
filter->is_dir = 0;
|
||||
/* no slash at the start */
|
||||
filter->is_abs = 0;
|
||||
}
|
||||
|
||||
/* a slash must be the first char, as we don't support PATH/FILE and PATH/DIR/ */
|
||||
if (filter->pattern[0] != '/') {
|
||||
free(filter);
|
||||
return 0;
|
||||
if (last[1] == 0) {
|
||||
/* slash at the end */
|
||||
filter->is_dir = 1;
|
||||
last[0] = 0; /* clear the slash */
|
||||
} else {
|
||||
/* no slash at the end */
|
||||
filter->is_dir = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +129,7 @@ struct snapraid_filter* filter_alloc_disk(int direction, const char* pattern)
|
|||
|
||||
/* it's a disk filter */
|
||||
filter->is_disk = 1;
|
||||
filter->is_path = 0;
|
||||
filter->is_abs = 0;
|
||||
filter->is_dir = 0;
|
||||
|
||||
/* no slash allowed in disk names */
|
||||
|
|
@ -171,9 +167,14 @@ const char* filter_type(struct snapraid_filter* filter, char* out, size_t out_si
|
|||
return out;
|
||||
}
|
||||
|
||||
static int filter_apply(struct snapraid_filter* filter, struct snapraid_filter** reason, const char* path, const char* name, int is_dir)
|
||||
static int filter_apply(struct snapraid_filter* filter, struct snapraid_filter** reason, const char* path, int is_dir)
|
||||
{
|
||||
int ret = 0;
|
||||
if (filter->root[0] != 0) { /* if it's a local filter */
|
||||
if (!path_is_root_of(filter->root, path)) /* applies it only if it matches the root */
|
||||
return 0;
|
||||
/* advance the path to compare to make it local */
|
||||
path += strlen(filter->root);
|
||||
}
|
||||
|
||||
/* match dirs with dirs and files with files */
|
||||
if (filter->is_dir && !is_dir)
|
||||
|
|
@ -181,13 +182,28 @@ static int filter_apply(struct snapraid_filter* filter, struct snapraid_filter**
|
|||
if (!filter->is_dir && is_dir)
|
||||
return 0;
|
||||
|
||||
if (filter->is_path) {
|
||||
/* skip initial slash, as always missing from the path */
|
||||
if (fnmatch(filter->pattern + 1, path, FNM_PATHNAME | FNM_CASEINSENSITIVE_FOR_WIN) == 0)
|
||||
int ret = 0;
|
||||
|
||||
if (filter->is_abs) {
|
||||
/* skip initial slash, as always missing in the path */
|
||||
if (wnmatch(filter->pattern + 1, path) == 0)
|
||||
ret = filter->direction;
|
||||
} else {
|
||||
if (fnmatch(filter->pattern, name, FNM_CASEINSENSITIVE_FOR_WIN) == 0)
|
||||
/* the patch is relative, first try to match from the root */
|
||||
if (wnmatch(filter->pattern, path) == 0) {
|
||||
ret = filter->direction;
|
||||
} else {
|
||||
/* then try to match after all the / presents */
|
||||
char* slash = strchr(path, '/');
|
||||
while (slash) {
|
||||
if (wnmatch(filter->pattern, slash + 1) == 0) {
|
||||
ret = filter->direction;
|
||||
break;
|
||||
}
|
||||
|
||||
slash = strchr(slash + 1, '/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reason != 0 && ret < 0)
|
||||
|
|
@ -196,47 +212,6 @@ static int filter_apply(struct snapraid_filter* filter, struct snapraid_filter**
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int filter_recurse(struct snapraid_filter* filter, struct snapraid_filter** reason, const char* const_path, int is_dir)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
char* name;
|
||||
unsigned i;
|
||||
|
||||
if (filter->root[0] != 0) { /* if it's a local filter */
|
||||
if (!path_is_root_of(filter->root, const_path)) /* applies it only if it matches the root */
|
||||
return 0;
|
||||
/* advance the path to compare to make it local */
|
||||
const_path += strlen(filter->root);
|
||||
}
|
||||
|
||||
pathcpy(path, sizeof(path), const_path);
|
||||
|
||||
/* filter all the dir/subdir until we reach the final file/dir */
|
||||
name = path;
|
||||
for (i = 0; path[i] != 0; ++i) {
|
||||
if (path[i] == '/') {
|
||||
/* set a terminator */
|
||||
path[i] = 0;
|
||||
|
||||
/* filter the directory */
|
||||
if (filter_apply(filter, reason, path, name, 1) != 0)
|
||||
return filter->direction;
|
||||
|
||||
/* restore the slash */
|
||||
path[i] = '/';
|
||||
|
||||
/* next name */
|
||||
name = path + i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* filter the final file/dir */
|
||||
if (filter_apply(filter, reason, path, name, is_dir) != 0)
|
||||
return filter->direction;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int filter_element(tommy_list* filterlist, struct snapraid_filter** reason, const char* disk, const char* sub, int is_dir, int is_def_include)
|
||||
{
|
||||
tommy_node* i;
|
||||
|
|
@ -249,14 +224,14 @@ static int filter_element(tommy_list* filterlist, struct snapraid_filter** reaso
|
|||
struct snapraid_filter* filter = i->data;
|
||||
|
||||
if (filter->is_disk) {
|
||||
if (fnmatch(filter->pattern, disk, FNM_CASEINSENSITIVE_FOR_WIN) == 0)
|
||||
if (wnmatch(filter->pattern, disk) == 0)
|
||||
ret = filter->direction;
|
||||
else
|
||||
ret = 0;
|
||||
if (reason != 0 && ret < 0)
|
||||
*reason = filter;
|
||||
} else {
|
||||
ret = filter_recurse(filter, reason, sub, is_dir);
|
||||
ret = filter_apply(filter, reason, sub, is_dir);
|
||||
}
|
||||
|
||||
if (ret > 0) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ struct snapraid_filter {
|
|||
char pattern[PATH_MAX]; /**< Filter pattern. */
|
||||
char root[PATH_MAX]; /**< If empty, it's a global pattern. If not empty, it's a local pattern that applies only to that dir. */
|
||||
int is_disk; /**< If the pattern is a disk one, otherwise it's a file pattern */
|
||||
int is_path; /**< If the pattern is a complete path, otherwise it's just a file name */
|
||||
int is_abs; /**< If the pattern is an absolute path (start with /), otherwise it's a relative one */
|
||||
int is_dir; /**< If the pattern is only for dir, otherwise it's only for file. */
|
||||
int direction; /**< If it's an inclusion (=1) or an exclusion (=-1). */
|
||||
tommy_node node; /**< Next node in the list. */
|
||||
|
|
|
|||
|
|
@ -1,491 +0,0 @@
|
|||
/* Copyright (C) 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if !HAVE_FNMATCH
|
||||
|
||||
/* Enable GNU extensions in fnmatch.h. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#if HAVE_FNMATCH_H
|
||||
#include <fnmatch.h>
|
||||
#else
|
||||
#include "fnmatch.h"
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#if HAVE_STRING_H || defined _LIBC
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#if defined STDC_HEADERS || defined _LIBC
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* For platforms which support the ISO C amendment 1 functionality we
|
||||
support user defined character classes. */
|
||||
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
|
||||
# include <wchar.h>
|
||||
# include <wctype.h>
|
||||
#endif
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined _LIBC || !defined __GNU_LIBRARY__
|
||||
|
||||
|
||||
# if defined STDC_HEADERS || !defined isascii
|
||||
# define ISASCII(c) 1
|
||||
# else
|
||||
# define ISASCII(c) isascii(c)
|
||||
# endif
|
||||
|
||||
# ifdef isblank
|
||||
# define ISBLANK(c) (ISASCII (c) && isblank (c))
|
||||
# else
|
||||
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
|
||||
# endif
|
||||
# ifdef isgraph
|
||||
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
|
||||
# else
|
||||
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
|
||||
# endif
|
||||
|
||||
# define ISPRINT(c) (ISASCII (c) && isprint (c))
|
||||
# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
|
||||
# define ISALNUM(c) (ISASCII (c) && isalnum (c))
|
||||
# define ISALPHA(c) (ISASCII (c) && isalpha (c))
|
||||
# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
|
||||
# define ISLOWER(c) (ISASCII (c) && islower (c))
|
||||
# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
|
||||
# define ISSPACE(c) (ISASCII (c) && isspace (c))
|
||||
# define ISUPPER(c) (ISASCII (c) && isupper (c))
|
||||
# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
|
||||
|
||||
# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
|
||||
|
||||
# if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
/* The GNU C library provides support for user-defined character classes
|
||||
and the functions from ISO C amendment 1. */
|
||||
# ifdef CHARCLASS_NAME_MAX
|
||||
# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
|
||||
# else
|
||||
/* This shouldn't happen but some implementation might still have this
|
||||
problem. Use a reasonable default value. */
|
||||
# define CHAR_CLASS_MAX_LENGTH 256
|
||||
# endif
|
||||
|
||||
# ifdef _LIBC
|
||||
# define IS_CHAR_CLASS(string) __wctype (string)
|
||||
# else
|
||||
# define IS_CHAR_CLASS(string) wctype (string)
|
||||
# endif
|
||||
# else
|
||||
# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
|
||||
|
||||
# define IS_CHAR_CLASS(string) \
|
||||
(STREQ (string, "alpha") || STREQ (string, "upper") \
|
||||
|| STREQ (string, "lower") || STREQ (string, "digit") \
|
||||
|| STREQ (string, "alnum") || STREQ (string, "xdigit") \
|
||||
|| STREQ (string, "space") || STREQ (string, "print") \
|
||||
|| STREQ (string, "punct") || STREQ (string, "graph") \
|
||||
|| STREQ (string, "cntrl") || STREQ (string, "blank"))
|
||||
# endif
|
||||
|
||||
/* Avoid depending on library functions or files
|
||||
whose names are inconsistent. */
|
||||
|
||||
# if !defined _LIBC && !defined getenv
|
||||
extern char *getenv (const char*);
|
||||
# endif
|
||||
|
||||
# ifndef errno
|
||||
extern int errno;
|
||||
# endif
|
||||
|
||||
/* This function doesn't exist on most systems. */
|
||||
|
||||
# if !defined HAVE___STRCHRNUL && !defined _LIBC
|
||||
static char *
|
||||
__strchrnul (const char *s, int c)
|
||||
{
|
||||
char *result = strchr (s, c);
|
||||
if (result == NULL)
|
||||
result = strchr (s, '\0');
|
||||
return result;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifndef internal_function
|
||||
/* Inside GNU libc we mark some function in a special way. In other
|
||||
environments simply ignore the marking. */
|
||||
# define internal_function
|
||||
# endif
|
||||
|
||||
/* Match STRING against the filename pattern PATTERN, returning zero if
|
||||
it matches, nonzero if not. */
|
||||
static int internal_fnmatch __P ((const char *pattern, const char *string,
|
||||
int no_leading_period, int flags))
|
||||
internal_function;
|
||||
static int
|
||||
internal_function
|
||||
internal_fnmatch (const char *pattern, const char *string, int no_leading_period, int flags)
|
||||
{
|
||||
register const char *p = pattern, *n = string;
|
||||
register unsigned char c;
|
||||
|
||||
/* Note that this evaluates C many times. */
|
||||
# ifdef _LIBC
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
|
||||
# else
|
||||
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
|
||||
# endif
|
||||
|
||||
while ((c = *p++) != '\0')
|
||||
{
|
||||
c = FOLD (c);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '?':
|
||||
if (*n == '\0')
|
||||
return FNM_NOMATCH;
|
||||
else if (*n == '/' && (flags & FNM_FILE_NAME))
|
||||
return FNM_NOMATCH;
|
||||
else if (*n == '.' && no_leading_period
|
||||
&& (n == string
|
||||
|| (n[-1] == '/' && (flags & FNM_FILE_NAME))))
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
if (!(flags & FNM_NOESCAPE))
|
||||
{
|
||||
c = *p++;
|
||||
if (c == '\0')
|
||||
/* Trailing \ loses. */
|
||||
return FNM_NOMATCH;
|
||||
c = FOLD (c);
|
||||
}
|
||||
if (FOLD ((unsigned char) *n) != c)
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
if (*n == '.' && no_leading_period
|
||||
&& (n == string
|
||||
|| (n[-1] == '/' && (flags & FNM_FILE_NAME))))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
for (c = *p++; c == '?' || c == '*'; c = *p++)
|
||||
{
|
||||
if (*n == '/' && (flags & FNM_FILE_NAME))
|
||||
/* A slash does not match a wildcard under FNM_FILE_NAME. */
|
||||
return FNM_NOMATCH;
|
||||
else if (c == '?')
|
||||
{
|
||||
/* A ? needs to match one character. */
|
||||
if (*n == '\0')
|
||||
/* There isn't another character; no match. */
|
||||
return FNM_NOMATCH;
|
||||
else
|
||||
/* One character of the string is consumed in matching
|
||||
this ? wildcard, so *??? won't match if there are
|
||||
less than three characters. */
|
||||
++n;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == '\0')
|
||||
/* The wildcard(s) is/are the last element of the pattern.
|
||||
If the name is a file name and contains another slash
|
||||
this does mean it cannot match. */
|
||||
return ((flags & FNM_FILE_NAME) && strchr (n, '/') != NULL
|
||||
? FNM_NOMATCH : 0);
|
||||
else
|
||||
{
|
||||
const char *endp;
|
||||
|
||||
endp = __strchrnul (n, (flags & FNM_FILE_NAME) ? '/' : '\0');
|
||||
|
||||
if (c == '[')
|
||||
{
|
||||
int flags2 = ((flags & FNM_FILE_NAME)
|
||||
? flags : (flags & ~FNM_PERIOD));
|
||||
|
||||
for (--p; n < endp; ++n)
|
||||
if (internal_fnmatch (p, n,
|
||||
(no_leading_period
|
||||
&& (n == string
|
||||
|| (n[-1] == '/'
|
||||
&& (flags
|
||||
& FNM_FILE_NAME)))),
|
||||
flags2)
|
||||
== 0)
|
||||
return 0;
|
||||
}
|
||||
else if (c == '/' && (flags & FNM_FILE_NAME))
|
||||
{
|
||||
while (*n != '\0' && *n != '/')
|
||||
++n;
|
||||
if (*n == '/'
|
||||
&& (internal_fnmatch (p, n + 1, flags & FNM_PERIOD,
|
||||
flags) == 0))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int flags2 = ((flags & FNM_FILE_NAME)
|
||||
? flags : (flags & ~FNM_PERIOD));
|
||||
|
||||
if (c == '\\' && !(flags & FNM_NOESCAPE))
|
||||
c = *p;
|
||||
c = FOLD (c);
|
||||
for (--p; n < endp; ++n)
|
||||
if (FOLD ((unsigned char) *n) == c
|
||||
&& (internal_fnmatch (p, n,
|
||||
(no_leading_period
|
||||
&& (n == string
|
||||
|| (n[-1] == '/'
|
||||
&& (flags
|
||||
& FNM_FILE_NAME)))),
|
||||
flags2) == 0))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we come here no match is possible with the wildcard. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
case '[':
|
||||
{
|
||||
/* Nonzero if the sense of the character class is inverted. */
|
||||
static int posixly_correct;
|
||||
register int not;
|
||||
char cold;
|
||||
|
||||
if (posixly_correct == 0)
|
||||
posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
|
||||
|
||||
if (*n == '\0')
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (*n == '.' && no_leading_period && (n == string
|
||||
|| (n[-1] == '/'
|
||||
&& (flags
|
||||
& FNM_FILE_NAME))))
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (*n == '/' && (flags & FNM_FILE_NAME))
|
||||
/* `/' cannot be matched. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
not = (*p == '!' || (posixly_correct < 0 && *p == '^'));
|
||||
if (not)
|
||||
++p;
|
||||
|
||||
c = *p++;
|
||||
for (;;)
|
||||
{
|
||||
unsigned char fn = FOLD ((unsigned char) *n);
|
||||
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
{
|
||||
if (*p == '\0')
|
||||
return FNM_NOMATCH;
|
||||
c = FOLD ((unsigned char) *p);
|
||||
++p;
|
||||
|
||||
if (c == fn)
|
||||
goto matched;
|
||||
}
|
||||
else if (c == '[' && *p == ':')
|
||||
{
|
||||
/* Leave room for the null. */
|
||||
char str[CHAR_CLASS_MAX_LENGTH + 1];
|
||||
size_t c1 = 0;
|
||||
# if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
wctype_t wt;
|
||||
# endif
|
||||
const char *startp = p;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (c1 == CHAR_CLASS_MAX_LENGTH)
|
||||
/* The name is too long and therefore the pattern
|
||||
is ill-formed. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
c = *++p;
|
||||
if (c == ':' && p[1] == ']')
|
||||
{
|
||||
p += 2;
|
||||
break;
|
||||
}
|
||||
if (c < 'a' || c >= 'z')
|
||||
{
|
||||
/* This cannot possibly be a character class name.
|
||||
Match it as a normal range. */
|
||||
p = startp;
|
||||
c = '[';
|
||||
goto normal_bracket;
|
||||
}
|
||||
str[c1++] = c;
|
||||
}
|
||||
str[c1] = '\0';
|
||||
|
||||
# if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
|
||||
wt = IS_CHAR_CLASS (str);
|
||||
if (wt == 0)
|
||||
/* Invalid character class name. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (__iswctype (__btowc ((unsigned char) *n), wt))
|
||||
goto matched;
|
||||
# else
|
||||
if ((STREQ (str, "alnum") && ISALNUM ((unsigned char) *n))
|
||||
|| (STREQ (str, "alpha") && ISALPHA ((unsigned char) *n))
|
||||
|| (STREQ (str, "blank") && ISBLANK ((unsigned char) *n))
|
||||
|| (STREQ (str, "cntrl") && ISCNTRL ((unsigned char) *n))
|
||||
|| (STREQ (str, "digit") && ISDIGIT ((unsigned char) *n))
|
||||
|| (STREQ (str, "graph") && ISGRAPH ((unsigned char) *n))
|
||||
|| (STREQ (str, "lower") && ISLOWER ((unsigned char) *n))
|
||||
|| (STREQ (str, "print") && ISPRINT ((unsigned char) *n))
|
||||
|| (STREQ (str, "punct") && ISPUNCT ((unsigned char) *n))
|
||||
|| (STREQ (str, "space") && ISSPACE ((unsigned char) *n))
|
||||
|| (STREQ (str, "upper") && ISUPPER ((unsigned char) *n))
|
||||
|| (STREQ (str, "xdigit") && ISXDIGIT ((unsigned char) *n)))
|
||||
goto matched;
|
||||
# endif
|
||||
}
|
||||
else if (c == '\0')
|
||||
/* [ (unterminated) loses. */
|
||||
return FNM_NOMATCH;
|
||||
else
|
||||
{
|
||||
normal_bracket:
|
||||
if (FOLD (c) == fn)
|
||||
goto matched;
|
||||
|
||||
cold = c;
|
||||
c = *p++;
|
||||
|
||||
if (c == '-' && *p != ']')
|
||||
{
|
||||
/* It is a range. */
|
||||
unsigned char cend = *p++;
|
||||
if (!(flags & FNM_NOESCAPE) && cend == '\\')
|
||||
cend = *p++;
|
||||
if (cend == '\0')
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (cold <= fn && fn <= FOLD (cend))
|
||||
goto matched;
|
||||
|
||||
c = *p++;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == ']')
|
||||
break;
|
||||
}
|
||||
|
||||
if (!not)
|
||||
return FNM_NOMATCH;
|
||||
break;
|
||||
|
||||
matched:
|
||||
/* Skip the rest of the [...] that already matched. */
|
||||
while (c != ']')
|
||||
{
|
||||
if (c == '\0')
|
||||
/* [... (unterminated) loses. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
c = *p++;
|
||||
if (!(flags & FNM_NOESCAPE) && c == '\\')
|
||||
{
|
||||
if (*p == '\0')
|
||||
return FNM_NOMATCH;
|
||||
/* XXX 1003.2d11 is unclear if this is right. */
|
||||
++p;
|
||||
}
|
||||
else if (c == '[' && *p == ':')
|
||||
{
|
||||
do
|
||||
if (*++p == '\0')
|
||||
return FNM_NOMATCH;
|
||||
while (*p != ':' || p[1] == ']');
|
||||
p += 2;
|
||||
c = *p;
|
||||
}
|
||||
}
|
||||
if (not)
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (c != FOLD ((unsigned char) *n))
|
||||
return FNM_NOMATCH;
|
||||
}
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
if (*n == '\0')
|
||||
return 0;
|
||||
|
||||
if ((flags & FNM_LEADING_DIR) && *n == '/')
|
||||
/* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
|
||||
return 0;
|
||||
|
||||
return FNM_NOMATCH;
|
||||
|
||||
# undef FOLD
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fnmatch (const char *pattern, const char *string, int flags)
|
||||
{
|
||||
return internal_fnmatch (pattern, string, flags & FNM_PERIOD, flags);
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
|
||||
#else
|
||||
|
||||
/* avoid the warning: ISO C forbids an empty translation unit */
|
||||
extern int make_iso_compilers_happy;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/* Copyright (C) 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _FNMATCH_H
|
||||
#define _FNMATCH_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
|
||||
# if !defined __GLIBC__ || !defined __P
|
||||
# undef __P
|
||||
# define __P(protos) protos
|
||||
# endif
|
||||
#else /* Not C++ or ANSI C. */
|
||||
# undef __P
|
||||
# define __P(protos) ()
|
||||
/* We can get away without defining `const' here only because in this file
|
||||
it is used only inside the prototype for `fnmatch', which is elided in
|
||||
non-ANSI C where `const' is problematical. */
|
||||
#endif /* C++ or ANSI C. */
|
||||
|
||||
#ifndef const
|
||||
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
# define __const const
|
||||
# else
|
||||
# define __const
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* We #undef these before defining them because some losing systems
|
||||
(HP-UX A.08.07 for example) define these in <unistd.h>. */
|
||||
#undef FNM_PATHNAME
|
||||
#undef FNM_NOESCAPE
|
||||
#undef FNM_PERIOD
|
||||
#undef FNM_LEADING_DIR
|
||||
#undef FNM_CASEFOLD
|
||||
|
||||
/* Bits set in the FLAGS argument to `fnmatch'. */
|
||||
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
|
||||
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
|
||||
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
|
||||
|
||||
#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
|
||||
# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
|
||||
# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
|
||||
# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
|
||||
#endif
|
||||
|
||||
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
|
||||
#define FNM_NOMATCH 1
|
||||
|
||||
/* This value is returned if the implementation does not support
|
||||
`fnmatch'. Since this is not the case here it will never be
|
||||
returned but the conformance test suites still require the symbol
|
||||
to be defined. */
|
||||
#ifdef _XOPEN_SOURCE
|
||||
# define FNM_NOSYS (-1)
|
||||
#endif
|
||||
|
||||
/* Match NAME against the filename pattern PATTERN,
|
||||
returning zero if it matches, FNM_NOMATCH if not. */
|
||||
extern int fnmatch __P ((__const char *__pattern, __const char *__name,
|
||||
int __flags));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* fnmatch.h */
|
||||
|
|
@ -219,12 +219,6 @@
|
|||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_FNMATCH_H
|
||||
#include <fnmatch.h>
|
||||
#else
|
||||
#include "fnmatch.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
|
@ -274,15 +268,6 @@ typedef pthread_cond_t thread_cond_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Disable case check in Windows.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
#define FNM_CASEINSENSITIVE_FOR_WIN FNM_CASEFOLD
|
||||
#else
|
||||
#define FNM_CASEINSENSITIVE_FOR_WIN 0
|
||||
#endif
|
||||
|
||||
#if HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -590,6 +590,271 @@ bail:
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
struct {
|
||||
const char* pattern;
|
||||
const char* text;
|
||||
int result;
|
||||
} WNMATCH_TEST[] = {
|
||||
/* basic literal matching */
|
||||
{ "hello", "hello", 0 },
|
||||
{ "hello", "world", 1 },
|
||||
{ "", "", 0 },
|
||||
{ "hello", "", 1 },
|
||||
{ "", "hello", 1 },
|
||||
|
||||
/* single asterisk (*) */
|
||||
{ "*", "anything", 0 },
|
||||
{ "*", "", 0 },
|
||||
{ "*.txt", "file.txt", 0 },
|
||||
{ "*.txt", "file.doc", 1 },
|
||||
{ "*file*", "myfile.txt", 0 },
|
||||
{ "f*le", "file", 0 },
|
||||
{ "f*le", "fiiiile", 0 },
|
||||
{ "f*le", "folder", 1 },
|
||||
{ "a*b*c", "abc", 0 },
|
||||
{ "a*b*c", "aXbYc", 0 },
|
||||
{ "a*b*c", "aXXbYYc", 0 },
|
||||
{ "a*b*c", "ac", 1 },
|
||||
{ "***", "anything", 0 },
|
||||
{ "*.txt", "notes.txt", 0 },
|
||||
{ "*.txt", "folder/notes.txt", 1 },
|
||||
{ "*.js", "main.jsx", 1 },
|
||||
|
||||
/* single asterisk with / */
|
||||
{ "*", "a/b", 1 },
|
||||
{ "*.txt", "dir/file.txt", 1 },
|
||||
{ "dir/*.txt", "dir/file.txt", 0 },
|
||||
{ "*/*.txt", "dir/file.txt", 0 },
|
||||
{ "*/*.txt", "a/b/file.txt", 1 },
|
||||
|
||||
/* question mark (?) */
|
||||
{ "?", "a", 0 },
|
||||
{ "?", "ab", 1 },
|
||||
{ "?", "", 1 },
|
||||
{ "file?.txt", "file1.txt", 0 },
|
||||
{ "file?.txt", "fileA.txt", 0 },
|
||||
{ "file?.txt", "file10.txt", 1 },
|
||||
{ "???", "abc", 0 },
|
||||
{ "???", "ab", 1 },
|
||||
{ "a?c", "abc", 0 },
|
||||
{ "a?c", "ac", 1 },
|
||||
{ "file?.txt", "file1.txt", 0 },
|
||||
{ "file?.txt", "file12.txt", 1 },
|
||||
|
||||
/* question mark with / */
|
||||
{ "?", "/", 1 },
|
||||
{ "dir?file", "dir/file", 1 },
|
||||
{ "dir?file", "dirAfile", 0 },
|
||||
|
||||
/* character classes [...] */
|
||||
{ "[abc]", "a", 0 },
|
||||
{ "[abc]", "b", 0 },
|
||||
{ "[abc]", "c", 0 },
|
||||
{ "[abc]", "d", 1 },
|
||||
{ "[abc]", "", 1 },
|
||||
{ "file[0-9].txt", "file5.txt", 0 },
|
||||
{ "file[0-9].txt", "fileA.txt", 1 },
|
||||
{ "[a-z]", "m", 0 },
|
||||
{ "[A-Z]", "M", 0 },
|
||||
{ "[0-9a-f]", "a", 0 },
|
||||
{ "[0-9a-f]", "5", 0 },
|
||||
{ "[0-9a-f]", "g", 1 },
|
||||
{ "[a-z].js", "p.js", 0 },
|
||||
{ "[a-z].js", "1.js", 1 },
|
||||
{ "[0-9].txt", "a.txt", 1 },
|
||||
{ "[!a-z].js", "b.js", 1 },
|
||||
|
||||
/* negated character classes [!...] */
|
||||
{ "[!abc]", "d", 0 },
|
||||
{ "[!abc]", "a", 1 },
|
||||
{ "[!0-9]", "a", 0 },
|
||||
{ "[!0-9]", "5", 1 },
|
||||
{ "file[!0-9].txt", "filea.txt", 0 },
|
||||
{ "file[!0-9].txt", "file5.txt", 1 },
|
||||
{ "[^abc]", "d", 0 },
|
||||
{ "[^abc]", "a", 1 },
|
||||
|
||||
/* character classes with / */
|
||||
{ "[a-z]", "/", 1 },
|
||||
{ "dir[/]file", "dir/file", 1 },
|
||||
|
||||
#ifdef WIN32
|
||||
/* case */
|
||||
{ "hello", "HELLO", 0 },
|
||||
{ "Hello", "hello", 0 },
|
||||
{ "*.TXT", "file.txt", 0 },
|
||||
{ "FILE.txt", "file.TXT", 0 },
|
||||
{ "[a-z]", "A", 0 },
|
||||
{ "[ABC]", "b", 0 },
|
||||
{ "[a-z].js", "A.js", 0 },
|
||||
{ "[a-z]", "M", 0 },
|
||||
#else
|
||||
{ "hello", "HELLO", 1 },
|
||||
{ "Hello", "hello", 1 },
|
||||
{ "*.TXT", "file.txt", 1 },
|
||||
{ "FILE.txt", "file.TXT", 1 },
|
||||
{ "[a-z]", "A", 1 },
|
||||
{ "[ABC]", "b", 1 },
|
||||
{ "[a-z].js", "A.js", 1 },
|
||||
{ "[a-z]", "M", 1 },
|
||||
#endif
|
||||
|
||||
/* the /xx/ collapse case */
|
||||
{ "a/**/b", "a/b", 0 },
|
||||
{ "a/**/b", "a/x/b", 0 },
|
||||
|
||||
/* double asterisk (xx/) at start */
|
||||
{ "**/*.txt", "file.txt", 0 },
|
||||
{ "**/*.txt", "dir/file.txt", 0 },
|
||||
{ "**/*.txt", "a/b/c/file.txt", 0 },
|
||||
{ "**/*.txt", "file.doc", 1 },
|
||||
{ "**/test.txt", "test.txt", 0 },
|
||||
{ "**/test.txt", "a/b/test.txt", 0 },
|
||||
{ "**/test.txt", "a/b/other.txt", 1 },
|
||||
{ "**/*file*", "myfile.txt", 0 },
|
||||
{ "**/*file*", "dir/myfile.txt", 0 },
|
||||
|
||||
/* double asterisk (/xx) at end */
|
||||
{ "src/**", "src/", 0 },
|
||||
{ "src/**", "src/file.c", 0 },
|
||||
{ "src/**", "src/a/b/c/file.c", 0 },
|
||||
{ "src/**", "other/file.c", 1 },
|
||||
{ "src/**", "src", 1 },
|
||||
{ "dir/**", "dir/subdir/", 0 },
|
||||
|
||||
/* double asterisk (/xx/) in middle */
|
||||
{ "src/**/*.c", "src/file.c", 0 },
|
||||
{ "src/**/*.c", "src/lib/file.c", 0 },
|
||||
{ "src/**/*.c", "src/lib/util/file.c", 0 },
|
||||
{ "src/**/*.c", "src/file.h", 1 },
|
||||
{ "src/**/*.c", "other/file.c", 1 },
|
||||
{ "a/**/b/**/c", "a/b/c", 0 },
|
||||
{ "a/**/b/**/c", "a/x/b/y/c", 0 },
|
||||
{ "a/**/b/**/c", "a/x/y/b/z/w/c", 0 },
|
||||
{ "a/**/b", "a/x/y/z/b", 0 },
|
||||
{ "/docs/**/api.md", "/docs/api.md", 0 },
|
||||
{ "a/**/b", "a/xb", 1 },
|
||||
{ "a/**/b", "ax/b", 1 },
|
||||
{ "a/**/b", "a/c/xb", 1 },
|
||||
{ "a/**/b", "ax/c/b", 1 },
|
||||
{ "a/**/b", "a/x/y/c", 1 },
|
||||
{ "a/**/b", "axb", 1 },
|
||||
|
||||
/* multiple recursion segments */
|
||||
{ "**/**/file", "file", 0 },
|
||||
{ "**/**/file", "a/b/c/file", 0 },
|
||||
{ "a/**/b/**/c", "a/b/c", 0 },
|
||||
{ "a/**/b/**/c", "a/1/b/2/c", 0 },
|
||||
|
||||
/* combined patterns */
|
||||
{ "*.{txt,doc}", "file.txt", 1 },
|
||||
{ "file[0-9]*.txt", "file5abc.txt", 0 },
|
||||
{ "dir/*/file?.txt", "dir/sub/file1.txt", 0 },
|
||||
{ "**/src/**/*.c", "project/src/lib/file.c", 0 },
|
||||
|
||||
/* edge cases */
|
||||
{ "**", "anything", 0 },
|
||||
{ "a/**", "a/b", 0 },
|
||||
{ "a**", "aaa", 0 },
|
||||
{ "**a", "xxa", 0 },
|
||||
{ "a/**/", "a/b/", 0 },
|
||||
{ "a/**/b", "a/b", 0 },
|
||||
{ "a/**/b", "a//b", 0 },
|
||||
{ "*/**/file.txt", "a/file.txt", 0 },
|
||||
{ "*/**/file.txt", "a/b/c/file.txt", 0 },
|
||||
{ "a**/file.txt", "afile.txt", 1 },
|
||||
{ "/*/**/file.txt", "/file.txt", 1 },
|
||||
{ "*/**/file.txt", "/file.txt", 0 },
|
||||
{ "src/**/**/file.txt", "src/file.txt", 0 },
|
||||
{ "src/**/**/file.txt", "src/sub/file.txt", 0 },
|
||||
{ "src/***/file.txt", "src/file.txt", 0 },
|
||||
{ "src/***/file.txt", "src/sub/file.txt", 0 },
|
||||
{ "src/***/file.txt", "src/sub/sub/file.txt", 0 },
|
||||
{ "src/****/file.txt", "src/file.txt", 0 },
|
||||
{ "src/****/file.txt", "src/sub/file.txt", 0 },
|
||||
{ "src/****/file.txt", "src/sub/sub/file.txt", 0 },
|
||||
{ "**/build", "a/b/build", 0 },
|
||||
{ "src/**/test.js", "src/ui/test.js", 0 },
|
||||
{ "dist/**", "dist/bin/app.exe", 0 },
|
||||
{ "src-**", "src-folder/file.js", 1 },
|
||||
{ "**pkg/init.py", "libs/core/pkg/init.py", 1 },
|
||||
{ "**.log", "error.log", 0 },
|
||||
{ "**.log", "var/log/sys.log", 1 },
|
||||
{ "src/**.js", "src/app.js", 0 },
|
||||
{ "src/**.js", "src/components/ui/button.js", 0 }, /* <<<<< .GITIGNORE DIFFERS */
|
||||
{ "a**b.txt", "ab.txt", 0 },
|
||||
{ "a**b.txt", "axxb.txt", 0 },
|
||||
{ "a**b.txt", "a/b.txt", 1 },
|
||||
{ "a**b.txt", "a/subdir/b.txt", 1 },
|
||||
{ "a**b.txt", "a_folder/sub/b.txt", 1 },
|
||||
{ "a**b.txt", "a_folder/sub/folter_b.txt", 1 },
|
||||
{ "**/build", "build", 0 },
|
||||
{ "**/build", "project/out/build", 0 },
|
||||
|
||||
/* negative tests */
|
||||
{ "/docs/**/api.md", "docs/api.txt", 1 },
|
||||
{ "a/**/b", "a/b/c", 1 },
|
||||
{ "static/**", "static", 1 },
|
||||
{ "src/*.js", "src/ui/app.js", 1 },
|
||||
{ "/config.*", "etc/config.json", 1 },
|
||||
{ "*/*/*.c", "main.c", 1 },
|
||||
{ "a/*/b", "a/b", 1 },
|
||||
{ "a/**/b", "axb", 1 },
|
||||
{ "a/**/b", "ab", 1 },
|
||||
{ "/**/logs", "logs", 1 },
|
||||
{ "/src/**/logs", "src/web/log", 1 },
|
||||
{ "foo//bar", "foo/bar", 1 },
|
||||
{ "a/**/b", "a/b/", 1 },
|
||||
{ "a**b**c", "acb", 1 },
|
||||
{ "src-**-pkg", "src-pkg", 1 },
|
||||
{ "**/test/*.js", "test/ui/app.js", 1 },
|
||||
|
||||
/* complex real-world patterns */
|
||||
{ "**/.git/**", ".git/config", 0 },
|
||||
{ "**/.git/**", "project/.git/hooks/pre-commit", 0 },
|
||||
{ "**/node_modules/**", "node_modules/pkg/index.js", 0 },
|
||||
{ "**/node_modules/**", "app/node_modules/pkg/file.js", 0 },
|
||||
{ "src/**/*.{c,h}", "src/main.c", 1 },
|
||||
{ "**/test_*.py", "test_example.py", 0 },
|
||||
{ "**/test_*.py", "tests/test_feature.py", 0 },
|
||||
|
||||
/* performance/stress patterns */
|
||||
{ "a*b*c*d*e*f*g*h*i*j*k", "abcdefghijk", 0 },
|
||||
{ "a*b*c*d*e*f*g*h*i*j*k", "aXbXcXdXeXfXgXhXiXjXk", 0 },
|
||||
{ "**/**/**/*.txt", "a/b/c/d/e/f.txt", 0 },
|
||||
|
||||
/* trailing/leading slashes */
|
||||
{ "dir/", "dir/", 0 },
|
||||
{ "/root/*", "/root/file", 0 },
|
||||
|
||||
/* complex embedded patterns */
|
||||
{ "src-**-pkg/*.js", "src-web-pkg/main.js", 0 },
|
||||
{ "src-**-pkg/*.js", "src-lazy-load-ui-pkg/main.js", 0 },
|
||||
{ "src-**-pkg/*.js", "src-web-pkg/subdir/main.js", 1 },
|
||||
|
||||
/* anchoring and slashes */
|
||||
{ "/root.txt", "root.txt", 1 },
|
||||
{ "/root.txt", "subdir/root.txt", 1 },
|
||||
{ "docs/", "docs", 1 },
|
||||
{ "docs/", "docs/", 0 },
|
||||
{ "**/temp/", "src/temp/", 0 },
|
||||
{ "**/temp/", "src/temp", 1 },
|
||||
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void test_wnmatch(void)
|
||||
{
|
||||
for (int i = 0; WNMATCH_TEST[i].pattern; ++i) {
|
||||
if (wnmatch(WNMATCH_TEST[i].pattern, WNMATCH_TEST[i].text) != WNMATCH_TEST[i].result) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Failed wnmatch test %s %s, expected %d\n", WNMATCH_TEST[i].pattern, WNMATCH_TEST[i].text, WNMATCH_TEST[i].result);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void selftest(void)
|
||||
{
|
||||
log_tag("selftest:\n");
|
||||
|
|
@ -614,6 +879,7 @@ void selftest(void)
|
|||
test_hash();
|
||||
test_crc32c();
|
||||
test_tommy();
|
||||
test_wnmatch();
|
||||
if (raid_selftest() != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Failed SELF test\n");
|
||||
|
|
|
|||
|
|
@ -1000,7 +1000,6 @@ int snapraid_main(int argc, char* argv[])
|
|||
if (!filter) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid filter specification '%s'\n", optarg);
|
||||
log_fatal("Filters using relative paths are not supported. Ensure to add an initial slash\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -490,13 +490,13 @@ static void state_config_check(struct snapraid_state* state, const char* path, t
|
|||
struct snapraid_filter* filter = i->data;
|
||||
for (j = state->disklist; j != 0; j = j->next) {
|
||||
struct snapraid_disk* disk = j->data;
|
||||
if (fnmatch(filter->pattern, disk->name, FNM_CASEINSENSITIVE_FOR_WIN) == 0)
|
||||
if (wnmatch(filter->pattern, disk->name) == 0)
|
||||
break;
|
||||
}
|
||||
if (j == 0) {
|
||||
/* check matching with parity disks */
|
||||
for (l = 0; l < state->level; ++l)
|
||||
if (fnmatch(filter->pattern, lev_config_name(l), FNM_CASEINSENSITIVE_FOR_WIN) == 0)
|
||||
if (wnmatch(filter->pattern, lev_config_name(l)) == 0)
|
||||
break;
|
||||
if (l == state->level) {
|
||||
/* LCOV_EXCL_START */
|
||||
|
|
@ -1234,7 +1234,6 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
if (!filter) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid 'exclude' specification '%s' in '%s' at line %u\n", buffer, path, line);
|
||||
log_fatal("Filters with relative paths are not supported. Ensure to add an initial slash\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
@ -1261,7 +1260,6 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
if (!filter) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_fatal("Invalid 'include' specification '%s' in '%s' at line %u\n", buffer, path, line);
|
||||
log_fatal("Filters with relative paths are not supported. Ensure to add an initial slash\n");
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2010,3 +2010,166 @@ void thread_yield(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************/
|
||||
/* wnmatch */
|
||||
|
||||
/**
|
||||
* Helper function for case-insensitive character comparison
|
||||
*/
|
||||
static inline int char_match(char p, char t)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return tolower((unsigned char)p) == tolower((unsigned char)t);
|
||||
#else
|
||||
return p == t;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Match character class [...]
|
||||
* Return 0 if NOT matched
|
||||
*/
|
||||
static const char* match_class(const char* p, char t)
|
||||
{
|
||||
int negate = 0;
|
||||
int matched = 0;
|
||||
|
||||
if (*p == '!' || *p == '^') {
|
||||
negate = 1;
|
||||
++p;
|
||||
}
|
||||
|
||||
while (*p && *p != ']') {
|
||||
if (p[1] == '-' && p[2] != ']' && p[2] != 0) {
|
||||
/* range [a-z] */
|
||||
char start = *p;
|
||||
char end = p[2];
|
||||
#ifdef WIN32
|
||||
start = tolower((unsigned char)start);
|
||||
end = tolower((unsigned char)end);
|
||||
t = tolower((unsigned char)t);
|
||||
#endif
|
||||
if (t >= start && t <= end)
|
||||
matched = 1;
|
||||
p += 3;
|
||||
} else {
|
||||
/* single character */
|
||||
if (char_match(*p, t))
|
||||
matched = 1;
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
if (*p == ']')
|
||||
++p;
|
||||
|
||||
if (negate)
|
||||
matched = !matched;
|
||||
if (!matched)
|
||||
return 0;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
int wnmatch(const char* p, const char* t)
|
||||
{
|
||||
char p1 = 0; /* previous char */
|
||||
while (*p) {
|
||||
char p0 = *p;
|
||||
switch (p0) {
|
||||
case '?' :
|
||||
/* ? matches any single character except / */
|
||||
if (*t == 0 || *t == '/')
|
||||
return 1;
|
||||
++p;
|
||||
++t;
|
||||
break;
|
||||
case '*' :
|
||||
/* check for ** */
|
||||
if (p[1] == '*') {
|
||||
/* skip the ** */
|
||||
p += 2;
|
||||
|
||||
/* munge all * */
|
||||
while (*p == '*')
|
||||
++p;
|
||||
|
||||
/* if its not near a slash, it's like a single * */
|
||||
if (p1 == '/' || *p == '/') {
|
||||
/* a ** at end matches everything */
|
||||
if (*p == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* In between slashes matches to nothing
|
||||
*
|
||||
* Check for /##/ or ^##/ (^ start of string)
|
||||
*
|
||||
* This is required for:
|
||||
* "/##/file.txt" matching "/file.txt"
|
||||
* "##/file.txt" matching "file.txt"
|
||||
* "x##/file.txt" NOT matching "xfile.txt"
|
||||
*/
|
||||
if (*p == '/' && (p1 == 0 || p1 == '/')) {
|
||||
/* try reducing to nothing */
|
||||
if (wnmatch(p + 1, t) == 0)
|
||||
return 0;
|
||||
/* otherwise / should match in the text */
|
||||
}
|
||||
|
||||
/* try matching with 0 or more characters */
|
||||
while (*t) {
|
||||
if (wnmatch(p, t) == 0)
|
||||
return 0;
|
||||
++t;
|
||||
}
|
||||
|
||||
/* try matching at the end */
|
||||
return wnmatch(p, t);
|
||||
}
|
||||
} else {
|
||||
/* skip the * */
|
||||
++p;
|
||||
}
|
||||
|
||||
/* a * at end matches rest of segment */
|
||||
if (*p == 0) {
|
||||
while (*t && *t != '/')
|
||||
++t;
|
||||
return *t != 0;
|
||||
}
|
||||
|
||||
/* try matching with 0 or more characters */
|
||||
while (*t && *t != '/') {
|
||||
if (wnmatch(p, t) == 0)
|
||||
return 0;
|
||||
++t;
|
||||
}
|
||||
|
||||
/* try matching at the end */
|
||||
return wnmatch(p, t);
|
||||
case '[' :
|
||||
/* character class */
|
||||
if (*t == 0 || *t == '/')
|
||||
return 1;
|
||||
|
||||
p = match_class(p + 1, *t);
|
||||
if (!p)
|
||||
return 1;
|
||||
|
||||
++t;
|
||||
break;
|
||||
default:
|
||||
/* literal character */
|
||||
if (*t == 0 || !char_match(*p, *t))
|
||||
return 1;
|
||||
++p;
|
||||
++t;
|
||||
break;
|
||||
}
|
||||
p1 = p0;
|
||||
}
|
||||
|
||||
/* match successful if we've consumed all text */
|
||||
return *t != 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,5 +487,19 @@ void thread_join(thread_id_t thread, void** retval);
|
|||
void thread_yield(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/****************************************************************************/
|
||||
/* match */
|
||||
|
||||
/*
|
||||
* Wild match function.
|
||||
*
|
||||
* - ? matches any single character except /
|
||||
* - * matches any sequence of characters except /
|
||||
* - ** (nearby a /) matches everything including /
|
||||
* - ** (not near a /) like *
|
||||
* - ##/ reduces to nothing in addition to the normal matching of ** (using # instead of * to mess the C comment)
|
||||
* - [...] matches character classes with support for ranges and negation lile [!...] or [^...], except /
|
||||
*/
|
||||
int wnmatch(const char* p, const char* t);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ AC_HEADER_ASSERT
|
|||
AC_HEADER_DIRENT
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h limits.h time.h sys/time.h])
|
||||
AC_CHECK_HEADERS([unistd.h getopt.h fnmatch.h io.h inttypes.h byteswap.h])
|
||||
AC_CHECK_HEADERS([unistd.h getopt.h io.h inttypes.h byteswap.h])
|
||||
AC_CHECK_HEADERS([pthread.h math.h])
|
||||
AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/sysmacros.h sys/mkdev.h])
|
||||
AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h mach/mach_time.h execinfo.h])
|
||||
|
|
@ -71,7 +71,7 @@ AC_CHECK_FUNCS([memset strchr strerror strrchr mkdir gettimeofday strtoul])
|
|||
AC_CHECK_FUNCS([getopt getopt_long snprintf vsnprintf sigaction])
|
||||
AC_CHECK_FUNCS([ftruncate fallocate access])
|
||||
AC_CHECK_FUNCS([fsync posix_fadvise sync_file_range syncfs])
|
||||
AC_CHECK_FUNCS([getc_unlocked ferror_unlocked fnmatch])
|
||||
AC_CHECK_FUNCS([getc_unlocked ferror_unlocked])
|
||||
AC_CHECK_FUNCS([futimes futimens futimesat localtime_r lutimes utimensat])
|
||||
AC_CHECK_FUNCS([fstatat flock])
|
||||
AC_CHECK_FUNCS([mach_absolute_time])
|
||||
|
|
|
|||
|
|
@ -1821,32 +1821,60 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
Muster werden verwendet, um eine Teilmenge von Dateien zum
|
||||
Ausschließen oder Einschließen in den Prozess auszuwählen.
|
||||
Muster bieten eine flexible Möglichkeit, Dateien für die Einbeziehung oder
|
||||
den Ausschluss zu filtern. Durch die Verwendung von Globbing\-Zeichen können Sie Regeln definieren,
|
||||
die mit bestimmten Dateinamen oder ganzen Verzeichnisstrukturen übereinstimmen, ohne
|
||||
jeden Pfad manuell auflisten zu müssen.
|
||||
.PP
|
||||
Das Fragezeichen \`?\` entspricht einem beliebigen einzelnen Zeichen außer dem
|
||||
Verzeichnistrennzeichen. Dies macht es nützlich für den Abgleich von Dateinamen mit variablen
|
||||
Zeichen, während das Muster auf eine einzelne Verzeichnisebene beschränkt bleibt.
|
||||
.PP
|
||||
Der einfache Stern \`*\` entspricht einer beliebigen Folge von Zeichen, aber wie das
|
||||
Fragezeichen überschreitet er niemals Verzeichnisgrenzen. Er stoppt beim
|
||||
Schrägstrich, was ihn für den Abgleich innerhalb einer einzelnen Pfadkomponente
|
||||
geeignet macht. Dies ist das Standardverhalten von Wildcards, das vom Shell\-
|
||||
Globbing bekannt ist.
|
||||
.PP
|
||||
Der Doppelstern \`**\` ist mächtiger; er entspricht jeder Folge von
|
||||
Zeichen einschließlich Verzeichnistrennzeichen. Dies ermöglicht es Mustern, über
|
||||
mehrere Verzeichnisebenen hinweg übereinzustimmen. Wenn \`**\` direkt in
|
||||
ein Muster eingebettet ist, kann es null oder mehr Zeichen einschließlich Schrägstrichen zwischen
|
||||
dem umgebenden wörtlichen Text entsprechen.
|
||||
.PP
|
||||
Die wichtigste Verwendung von \`**\` ist in der speziellen Form \`/**/\`. Dies entspricht
|
||||
null oder mehr vollständigen Verzeichnisebenen, was es möglich macht, Dateien
|
||||
in jeder Tiefe eines Verzeichnisbaums abzugleichen, ohne die genaue Pfadstruktur zu kennen.
|
||||
Zum Beispiel entspricht das Muster \`src/**/main.js\` dem Pfad \`src/main.js\` (Überspringen
|
||||
von null Verzeichnissen), \`src/ui/main.js\` (Überspringen eines Verzeichnisses) und
|
||||
\`src/ui/components/main.js\` (Überspringen von zwei Verzeichnissen).
|
||||
.PP
|
||||
Zeichenklassen mit eckigen Klammern \`[]\` entsprechen einem einzelnen Zeichen aus einer
|
||||
bestimmten Menge oder einem Bereich. Wie die anderen Einzelzeichenmuster
|
||||
entsprechen sie nicht den Verzeichnistrennzeichen. Klassen unterstützen Bereiche und Negierung durch
|
||||
ein Ausrufezeichen.
|
||||
.PP
|
||||
Der grundlegende Unterschied, den man sich merken sollte, ist, dass \`*\`, \`?\` und Zeichenklassen
|
||||
alle Verzeichnisgrenzen respektieren und nur innerhalb einer einzelnen Pfadkomponente
|
||||
übereinstimmen, während \`**\` das einzige Muster ist, das über Verzeichnistrennzeichen
|
||||
hinweg übereinstimmen kann.
|
||||
.PP
|
||||
Es gibt vier verschiedene Arten von Mustern:
|
||||
.TP
|
||||
.B FILE
|
||||
Wählt jede Datei namens DATEI aus. Sie können beliebige
|
||||
Globbing\-Zeichen wie * und ? sowie Zeichenklassen wie [a\-z]
|
||||
verwenden. Dieses Muster gilt nur für Dateien, nicht für
|
||||
Verzeichnisse.
|
||||
Wählt jede Datei mit dem Namen FILE aus.
|
||||
Dieses Muster gilt nur für Dateien, nicht für Verzeichnisse.
|
||||
.TP
|
||||
.B DIR/
|
||||
Wählt jedes Verzeichnis namens VERZ und alles darin aus.
|
||||
Sie können beliebige Globbing\-Zeichen wie * und ? verwenden.
|
||||
Wählt jedes Verzeichnis mit dem Namen DIR und alles darin aus.
|
||||
Dieses Muster gilt nur für Verzeichnisse, nicht für Dateien.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Wählt den exakt angegebenen Dateipfad aus. Sie können beliebige
|
||||
Globbing\-Zeichen wie * und ? verwenden, aber sie stimmen niemals
|
||||
mit einem Verzeichnis\-Slash überein.
|
||||
Dieses Muster gilt nur für Dateien, nicht für Verzeichnisse.
|
||||
Wählt den exakt angegebenen Dateipfad aus. Dieses Muster gilt
|
||||
nur für Dateien, nicht für Verzeichnisse.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Wählt den exakt angegebenen Verzeichnispfad und alles darin
|
||||
aus. Sie können beliebige Globbing\-Zeichen wie * und ? verwenden,
|
||||
aber sie stimmen niemals mit einem Verzeichnis\-Slash überein.
|
||||
Wählt den exakt angegebenen Verzeichnispfad und alles darin aus.
|
||||
Dieses Muster gilt nur für Verzeichnisse, nicht für Dateien.
|
||||
.PP
|
||||
Wenn Sie einen absoluten Pfad angeben, der mit / beginnt, wird er
|
||||
|
|
|
|||
|
|
@ -1437,32 +1437,60 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
Muster werden verwendet, um eine Teilmenge von Dateien zum
|
||||
Ausschließen oder Einschließen in den Prozess auszuwählen.
|
||||
Muster bieten eine flexible Möglichkeit, Dateien für die Einbeziehung oder
|
||||
den Ausschluss zu filtern. Durch die Verwendung von Globbing-Zeichen können Sie Regeln definieren,
|
||||
die mit bestimmten Dateinamen oder ganzen Verzeichnisstrukturen übereinstimmen, ohne
|
||||
jeden Pfad manuell auflisten zu müssen.
|
||||
|
||||
Das Fragezeichen `?` entspricht einem beliebigen einzelnen Zeichen außer dem
|
||||
Verzeichnistrennzeichen. Dies macht es nützlich für den Abgleich von Dateinamen mit variablen
|
||||
Zeichen, während das Muster auf eine einzelne Verzeichnisebene beschränkt bleibt.
|
||||
|
||||
Der einfache Stern `*` entspricht einer beliebigen Folge von Zeichen, aber wie das
|
||||
Fragezeichen überschreitet er niemals Verzeichnisgrenzen. Er stoppt beim
|
||||
Schrägstrich, was ihn für den Abgleich innerhalb einer einzelnen Pfadkomponente
|
||||
geeignet macht. Dies ist das Standardverhalten von Wildcards, das vom Shell-
|
||||
Globbing bekannt ist.
|
||||
|
||||
Der Doppelstern `**` ist mächtiger; er entspricht jeder Folge von
|
||||
Zeichen einschließlich Verzeichnistrennzeichen. Dies ermöglicht es Mustern, über
|
||||
mehrere Verzeichnisebenen hinweg übereinzustimmen. Wenn `**` direkt in
|
||||
ein Muster eingebettet ist, kann es null oder mehr Zeichen einschließlich Schrägstrichen zwischen
|
||||
dem umgebenden wörtlichen Text entsprechen.
|
||||
|
||||
Die wichtigste Verwendung von `**` ist in der speziellen Form `/**/`. Dies entspricht
|
||||
null oder mehr vollständigen Verzeichnisebenen, was es möglich macht, Dateien
|
||||
in jeder Tiefe eines Verzeichnisbaums abzugleichen, ohne die genaue Pfadstruktur zu kennen.
|
||||
Zum Beispiel entspricht das Muster `src/**/main.js` dem Pfad `src/main.js` (Überspringen
|
||||
von null Verzeichnissen), `src/ui/main.js` (Überspringen eines Verzeichnisses) und
|
||||
`src/ui/components/main.js` (Überspringen von zwei Verzeichnissen).
|
||||
|
||||
Zeichenklassen mit eckigen Klammern `[]` entsprechen einem einzelnen Zeichen aus einer
|
||||
bestimmten Menge oder einem Bereich. Wie die anderen Einzelzeichenmuster
|
||||
entsprechen sie nicht den Verzeichnistrennzeichen. Klassen unterstützen Bereiche und Negierung durch
|
||||
ein Ausrufezeichen.
|
||||
|
||||
Der grundlegende Unterschied, den man sich merken sollte, ist, dass `*`, `?` und Zeichenklassen
|
||||
alle Verzeichnisgrenzen respektieren und nur innerhalb einer einzelnen Pfadkomponente
|
||||
übereinstimmen, während `**` das einzige Muster ist, das über Verzeichnistrennzeichen
|
||||
hinweg übereinstimmen kann.
|
||||
|
||||
Es gibt vier verschiedene Arten von Mustern:
|
||||
|
||||
=FILE
|
||||
Wählt jede Datei namens DATEI aus. Sie können beliebige
|
||||
Globbing-Zeichen wie * und ? sowie Zeichenklassen wie [a-z]
|
||||
verwenden. Dieses Muster gilt nur für Dateien, nicht für
|
||||
Verzeichnisse.
|
||||
Wählt jede Datei mit dem Namen FILE aus.
|
||||
Dieses Muster gilt nur für Dateien, nicht für Verzeichnisse.
|
||||
|
||||
=DIR/
|
||||
Wählt jedes Verzeichnis namens VERZ und alles darin aus.
|
||||
Sie können beliebige Globbing-Zeichen wie * und ? verwenden.
|
||||
Wählt jedes Verzeichnis mit dem Namen DIR und alles darin aus.
|
||||
Dieses Muster gilt nur für Verzeichnisse, nicht für Dateien.
|
||||
|
||||
=/PATH/FILE
|
||||
Wählt den exakt angegebenen Dateipfad aus. Sie können beliebige
|
||||
Globbing-Zeichen wie * und ? verwenden, aber sie stimmen niemals
|
||||
mit einem Verzeichnis-Slash überein.
|
||||
Dieses Muster gilt nur für Dateien, nicht für Verzeichnisse.
|
||||
Wählt den exakt angegebenen Dateipfad aus. Dieses Muster gilt
|
||||
nur für Dateien, nicht für Verzeichnisse.
|
||||
|
||||
=/PATH/DIR/
|
||||
Wählt den exakt angegebenen Verzeichnispfad und alles darin
|
||||
aus. Sie können beliebige Globbing-Zeichen wie * und ? verwenden,
|
||||
aber sie stimmen niemals mit einem Verzeichnis-Slash überein.
|
||||
Wählt den exakt angegebenen Verzeichnispfad und alles darin aus.
|
||||
Dieses Muster gilt nur für Verzeichnisse, nicht für Dateien.
|
||||
|
||||
Wenn Sie einen absoluten Pfad angeben, der mit / beginnt, wird er
|
||||
|
|
|
|||
|
|
@ -1536,32 +1536,60 @@ Ein Beispiel für eine typische Konfiguration für Windows ist:
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
Muster werden verwendet, um eine Teilmenge von Dateien zum
|
||||
Ausschließen oder Einschließen in den Prozess auszuwählen.
|
||||
Muster bieten eine flexible Möglichkeit, Dateien für die Einbeziehung oder
|
||||
den Ausschluss zu filtern. Durch die Verwendung von Globbing-Zeichen können Sie Regeln definieren,
|
||||
die mit bestimmten Dateinamen oder ganzen Verzeichnisstrukturen übereinstimmen, ohne
|
||||
jeden Pfad manuell auflisten zu müssen.
|
||||
|
||||
Das Fragezeichen `?` entspricht einem beliebigen einzelnen Zeichen außer dem
|
||||
Verzeichnistrennzeichen. Dies macht es nützlich für den Abgleich von Dateinamen mit variablen
|
||||
Zeichen, während das Muster auf eine einzelne Verzeichnisebene beschränkt bleibt.
|
||||
|
||||
Der einfache Stern `*` entspricht einer beliebigen Folge von Zeichen, aber wie das
|
||||
Fragezeichen überschreitet er niemals Verzeichnisgrenzen. Er stoppt beim
|
||||
Schrägstrich, was ihn für den Abgleich innerhalb einer einzelnen Pfadkomponente
|
||||
geeignet macht. Dies ist das Standardverhalten von Wildcards, das vom Shell-
|
||||
Globbing bekannt ist.
|
||||
|
||||
Der Doppelstern `**` ist mächtiger; er entspricht jeder Folge von
|
||||
Zeichen einschließlich Verzeichnistrennzeichen. Dies ermöglicht es Mustern, über
|
||||
mehrere Verzeichnisebenen hinweg übereinzustimmen. Wenn `**` direkt in
|
||||
ein Muster eingebettet ist, kann es null oder mehr Zeichen einschließlich Schrägstrichen zwischen
|
||||
dem umgebenden wörtlichen Text entsprechen.
|
||||
|
||||
Die wichtigste Verwendung von `**` ist in der speziellen Form `/**/`. Dies entspricht
|
||||
null oder mehr vollständigen Verzeichnisebenen, was es möglich macht, Dateien
|
||||
in jeder Tiefe eines Verzeichnisbaums abzugleichen, ohne die genaue Pfadstruktur zu kennen.
|
||||
Zum Beispiel entspricht das Muster `src/**/main.js` dem Pfad `src/main.js` (Überspringen
|
||||
von null Verzeichnissen), `src/ui/main.js` (Überspringen eines Verzeichnisses) und
|
||||
`src/ui/components/main.js` (Überspringen von zwei Verzeichnissen).
|
||||
|
||||
Zeichenklassen mit eckigen Klammern `[]` entsprechen einem einzelnen Zeichen aus einer
|
||||
bestimmten Menge oder einem Bereich. Wie die anderen Einzelzeichenmuster
|
||||
entsprechen sie nicht den Verzeichnistrennzeichen. Klassen unterstützen Bereiche und Negierung durch
|
||||
ein Ausrufezeichen.
|
||||
|
||||
Der grundlegende Unterschied, den man sich merken sollte, ist, dass `*`, `?` und Zeichenklassen
|
||||
alle Verzeichnisgrenzen respektieren und nur innerhalb einer einzelnen Pfadkomponente
|
||||
übereinstimmen, während `**` das einzige Muster ist, das über Verzeichnistrennzeichen
|
||||
hinweg übereinstimmen kann.
|
||||
|
||||
Es gibt vier verschiedene Arten von Mustern:
|
||||
|
||||
FILE
|
||||
Wählt jede Datei namens DATEI aus. Sie können beliebige
|
||||
Globbing-Zeichen wie * und ? sowie Zeichenklassen wie [a-z]
|
||||
verwenden. Dieses Muster gilt nur für Dateien, nicht für
|
||||
Verzeichnisse.
|
||||
Wählt jede Datei mit dem Namen FILE aus.
|
||||
Dieses Muster gilt nur für Dateien, nicht für Verzeichnisse.
|
||||
|
||||
DIR/
|
||||
Wählt jedes Verzeichnis namens VERZ und alles darin aus.
|
||||
Sie können beliebige Globbing-Zeichen wie * und ? verwenden.
|
||||
Wählt jedes Verzeichnis mit dem Namen DIR und alles darin aus.
|
||||
Dieses Muster gilt nur für Verzeichnisse, nicht für Dateien.
|
||||
|
||||
/PATH/FILE
|
||||
Wählt den exakt angegebenen Dateipfad aus. Sie können beliebige
|
||||
Globbing-Zeichen wie * und ? verwenden, aber sie stimmen niemals
|
||||
mit einem Verzeichnis-Slash überein.
|
||||
Dieses Muster gilt nur für Dateien, nicht für Verzeichnisse.
|
||||
Wählt den exakt angegebenen Dateipfad aus. Dieses Muster gilt
|
||||
nur für Dateien, nicht für Verzeichnisse.
|
||||
|
||||
/PATH/DIR/
|
||||
Wählt den exakt angegebenen Verzeichnispfad und alles darin
|
||||
aus. Sie können beliebige Globbing-Zeichen wie * und ? verwenden,
|
||||
aber sie stimmen niemals mit einem Verzeichnis-Slash überein.
|
||||
Wählt den exakt angegebenen Verzeichnispfad und alles darin aus.
|
||||
Dieses Muster gilt nur für Verzeichnisse, nicht für Dateien.
|
||||
|
||||
Wenn Sie einen absoluten Pfad angeben, der mit / beginnt, wird er
|
||||
|
|
|
|||
|
|
@ -1771,32 +1771,61 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
Los patrones se utilizan para seleccionar un subconjunto de archivos
|
||||
para excluir o incluir en el proceso.
|
||||
Los patrones proporcionan una forma flexible de filtrar archivos para su inclusión o
|
||||
exclusión. Al usar caracteres de globbing, puede definir reglas que coincidan con
|
||||
nombres de archivos específicos o estructuras de directorios completas sin
|
||||
enumerar cada ruta manualmente.
|
||||
.PP
|
||||
El signo de interrogación \`?\` coincide con cualquier carácter individual excepto el
|
||||
separador de directorios. Esto lo hace útil para hacer coincidir nombres de archivos con
|
||||
caracteres variables manteniendo el patrón limitado a un solo nivel de directorio.
|
||||
.PP
|
||||
El asterisco simple \`*\` coincide con cualquier secuencia de caracteres, pero al igual que el
|
||||
signo de interrogación, nunca cruza los límites de los directorios. Se detiene en la
|
||||
barra diagonal, lo que lo hace adecuado para buscar coincidencias dentro de un solo
|
||||
componente de ruta. Este es el comportamiento estándar de los comodines familiar
|
||||
del globbing de la shell.
|
||||
.PP
|
||||
el doble asterisco \`**\` es más potente, coincide con cualquier secuencia de
|
||||
caracteres, incluidos los separadores de directorios. Esto permite que los patrones coincidan
|
||||
a través de múltiples niveles de directorio. Cuando \`**\` aparece incrustado directamente en
|
||||
un patrón, puede coincidir con cero o más caracteres, incluidas las barras diagonales entre
|
||||
el texto literal circundante.
|
||||
.PP
|
||||
El uso más importante de \`**\` es en la forma especial \`/**/\`. Esta coincide con
|
||||
cero o más niveles de directorio completos, lo que permite que los archivos coincidan
|
||||
a cualquier profundidad en un árbol de directorios sin conocer la estructura exacta de la ruta.
|
||||
Por ejemplo, el patrón \`src/**/main.js\` coincide con \`src/main.js\` (saltando
|
||||
cero directorios), \`src/ui/main.js\` (saltando un directorio) y
|
||||
\`src/ui/components/main.js\` (saltando dos directorios).
|
||||
.PP
|
||||
Las clases de caracteres que utilizan corchetes \`[]\` coinciden con un solo carácter de un
|
||||
conjunto o rango especificado. Al igual que los otros patrones de un solo carácter,
|
||||
no coinciden con los separadores de directorios. Las clases admiten rangos y negación mediante
|
||||
un signo de exclamación.
|
||||
.PP
|
||||
La distinción fundamental que debe recordar es que \`*\`, \`?\` y las clases de caracteres
|
||||
respetan los límites de los directorios y solo coinciden dentro de un único
|
||||
componente de ruta, mientras que \`**\` es el único patrón que puede coincidir a través de
|
||||
los separadores de directorios.
|
||||
.PP
|
||||
Hay cuatro tipos diferentes de patrones:
|
||||
.TP
|
||||
.B FILE
|
||||
Selecciona cualquier archivo llamado FILE. Puede usar
|
||||
cualquier carácter globbing como * y ?, y clases de caracteres
|
||||
como [a\-z]. Este patrón se aplica solo a archivos, no a directorios.
|
||||
Selecciona cualquier archivo llamado FILE.
|
||||
Este patrón se aplica solo a archivos, no a directorios.
|
||||
.TP
|
||||
.B DIR/
|
||||
Selecciona cualquier directorio llamado DIR y todo lo que
|
||||
contiene. Puede usar cualquier carácter globbing como * y ?.
|
||||
Selecciona cualquier directorio llamado DIR y todo lo que hay dentro.
|
||||
Este patrón se aplica solo a directorios, no a archivos.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Selecciona la ruta de archivo exacta especificada. Puede usar
|
||||
cualquier carácter globbing como * y ?, pero nunca coinciden
|
||||
con una barra de directorio.
|
||||
Este patrón se aplica solo a archivos, no a directorios.
|
||||
Selecciona la ruta exacta del archivo especificado. Este patrón se aplica
|
||||
solo a archivos, no a directorios.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Selecciona la ruta de directorio exacta especificada y todo
|
||||
lo que contiene. Puede usar cualquier carácter globbing como * y ?,
|
||||
pero nunca coinciden con una barra de directorio.
|
||||
Este patrón se aplica solo a directorios, no a archivos.
|
||||
Selecciona la ruta exacta del directorio especificado y todo lo que hay
|
||||
dentro. Este patrón se aplica solo a directorios, no a archivos.
|
||||
.PP
|
||||
Cuando especifica una ruta absoluta que comienza con /, se aplica
|
||||
en el directorio raíz del array, no en el directorio raíz del
|
||||
|
|
|
|||
|
|
@ -1398,32 +1398,61 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
Los patrones se utilizan para seleccionar un subconjunto de archivos
|
||||
para excluir o incluir en el proceso.
|
||||
Los patrones proporcionan una forma flexible de filtrar archivos para su inclusión o
|
||||
exclusión. Al usar caracteres de globbing, puede definir reglas que coincidan con
|
||||
nombres de archivos específicos o estructuras de directorios completas sin
|
||||
enumerar cada ruta manualmente.
|
||||
|
||||
El signo de interrogación `?` coincide con cualquier carácter individual excepto el
|
||||
separador de directorios. Esto lo hace útil para hacer coincidir nombres de archivos con
|
||||
caracteres variables manteniendo el patrón limitado a un solo nivel de directorio.
|
||||
|
||||
El asterisco simple `*` coincide con cualquier secuencia de caracteres, pero al igual que el
|
||||
signo de interrogación, nunca cruza los límites de los directorios. Se detiene en la
|
||||
barra diagonal, lo que lo hace adecuado para buscar coincidencias dentro de un solo
|
||||
componente de ruta. Este es el comportamiento estándar de los comodines familiar
|
||||
del globbing de la shell.
|
||||
|
||||
el doble asterisco `**` es más potente, coincide con cualquier secuencia de
|
||||
caracteres, incluidos los separadores de directorios. Esto permite que los patrones coincidan
|
||||
a través de múltiples niveles de directorio. Cuando `**` aparece incrustado directamente en
|
||||
un patrón, puede coincidir con cero o más caracteres, incluidas las barras diagonales entre
|
||||
el texto literal circundante.
|
||||
|
||||
El uso más importante de `**` es en la forma especial `/**/`. Esta coincide con
|
||||
cero o más niveles de directorio completos, lo que permite que los archivos coincidan
|
||||
a cualquier profundidad en un árbol de directorios sin conocer la estructura exacta de la ruta.
|
||||
Por ejemplo, el patrón `src/**/main.js` coincide con `src/main.js` (saltando
|
||||
cero directorios), `src/ui/main.js` (saltando un directorio) y
|
||||
`src/ui/components/main.js` (saltando dos directorios).
|
||||
|
||||
Las clases de caracteres que utilizan corchetes `[]` coinciden con un solo carácter de un
|
||||
conjunto o rango especificado. Al igual que los otros patrones de un solo carácter,
|
||||
no coinciden con los separadores de directorios. Las clases admiten rangos y negación mediante
|
||||
un signo de exclamación.
|
||||
|
||||
La distinción fundamental que debe recordar es que `*`, `?` y las clases de caracteres
|
||||
respetan los límites de los directorios y solo coinciden dentro de un único
|
||||
componente de ruta, mientras que `**` es el único patrón que puede coincidir a través de
|
||||
los separadores de directorios.
|
||||
|
||||
Hay cuatro tipos diferentes de patrones:
|
||||
|
||||
=FILE
|
||||
Selecciona cualquier archivo llamado FILE. Puede usar
|
||||
cualquier carácter globbing como * y ?, y clases de caracteres
|
||||
como [a-z]. Este patrón se aplica solo a archivos, no a directorios.
|
||||
Selecciona cualquier archivo llamado FILE.
|
||||
Este patrón se aplica solo a archivos, no a directorios.
|
||||
|
||||
=DIR/
|
||||
Selecciona cualquier directorio llamado DIR y todo lo que
|
||||
contiene. Puede usar cualquier carácter globbing como * y ?.
|
||||
Selecciona cualquier directorio llamado DIR y todo lo que hay dentro.
|
||||
Este patrón se aplica solo a directorios, no a archivos.
|
||||
|
||||
=/PATH/FILE
|
||||
Selecciona la ruta de archivo exacta especificada. Puede usar
|
||||
cualquier carácter globbing como * y ?, pero nunca coinciden
|
||||
con una barra de directorio.
|
||||
Este patrón se aplica solo a archivos, no a directorios.
|
||||
Selecciona la ruta exacta del archivo especificado. Este patrón se aplica
|
||||
solo a archivos, no a directorios.
|
||||
|
||||
=/PATH/DIR/
|
||||
Selecciona la ruta de directorio exacta especificada y todo
|
||||
lo que contiene. Puede usar cualquier carácter globbing como * y ?,
|
||||
pero nunca coinciden con una barra de directorio.
|
||||
Este patrón se aplica solo a directorios, no a archivos.
|
||||
Selecciona la ruta exacta del directorio especificado y todo lo que hay
|
||||
dentro. Este patrón se aplica solo a directorios, no a archivos.
|
||||
|
||||
Cuando especifica una ruta absoluta que comienza con /, se aplica
|
||||
en el directorio raíz del array, no en el directorio raíz del
|
||||
|
|
|
|||
|
|
@ -1497,32 +1497,61 @@ Un ejemplo de una configuración típica para Windows es:
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
Los patrones se utilizan para seleccionar un subconjunto de archivos
|
||||
para excluir o incluir en el proceso.
|
||||
Los patrones proporcionan una forma flexible de filtrar archivos para su inclusión o
|
||||
exclusión. Al usar caracteres de globbing, puede definir reglas que coincidan con
|
||||
nombres de archivos específicos o estructuras de directorios completas sin
|
||||
enumerar cada ruta manualmente.
|
||||
|
||||
El signo de interrogación `?` coincide con cualquier carácter individual excepto el
|
||||
separador de directorios. Esto lo hace útil para hacer coincidir nombres de archivos con
|
||||
caracteres variables manteniendo el patrón limitado a un solo nivel de directorio.
|
||||
|
||||
El asterisco simple `*` coincide con cualquier secuencia de caracteres, pero al igual que el
|
||||
signo de interrogación, nunca cruza los límites de los directorios. Se detiene en la
|
||||
barra diagonal, lo que lo hace adecuado para buscar coincidencias dentro de un solo
|
||||
componente de ruta. Este es el comportamiento estándar de los comodines familiar
|
||||
del globbing de la shell.
|
||||
|
||||
el doble asterisco `**` es más potente, coincide con cualquier secuencia de
|
||||
caracteres, incluidos los separadores de directorios. Esto permite que los patrones coincidan
|
||||
a través de múltiples niveles de directorio. Cuando `**` aparece incrustado directamente en
|
||||
un patrón, puede coincidir con cero o más caracteres, incluidas las barras diagonales entre
|
||||
el texto literal circundante.
|
||||
|
||||
El uso más importante de `**` es en la forma especial `/**/`. Esta coincide con
|
||||
cero o más niveles de directorio completos, lo que permite que los archivos coincidan
|
||||
a cualquier profundidad en un árbol de directorios sin conocer la estructura exacta de la ruta.
|
||||
Por ejemplo, el patrón `src/**/main.js` coincide con `src/main.js` (saltando
|
||||
cero directorios), `src/ui/main.js` (saltando un directorio) y
|
||||
`src/ui/components/main.js` (saltando dos directorios).
|
||||
|
||||
Las clases de caracteres que utilizan corchetes `[]` coinciden con un solo carácter de un
|
||||
conjunto o rango especificado. Al igual que los otros patrones de un solo carácter,
|
||||
no coinciden con los separadores de directorios. Las clases admiten rangos y negación mediante
|
||||
un signo de exclamación.
|
||||
|
||||
La distinción fundamental que debe recordar es que `*`, `?` y las clases de caracteres
|
||||
respetan los límites de los directorios y solo coinciden dentro de un único
|
||||
componente de ruta, mientras que `**` es el único patrón que puede coincidir a través de
|
||||
los separadores de directorios.
|
||||
|
||||
Hay cuatro tipos diferentes de patrones:
|
||||
|
||||
FILE
|
||||
Selecciona cualquier archivo llamado FILE. Puede usar
|
||||
cualquier carácter globbing como * y ?, y clases de caracteres
|
||||
como [a-z]. Este patrón se aplica solo a archivos, no a directorios.
|
||||
Selecciona cualquier archivo llamado FILE.
|
||||
Este patrón se aplica solo a archivos, no a directorios.
|
||||
|
||||
DIR/
|
||||
Selecciona cualquier directorio llamado DIR y todo lo que
|
||||
contiene. Puede usar cualquier carácter globbing como * y ?.
|
||||
Selecciona cualquier directorio llamado DIR y todo lo que hay dentro.
|
||||
Este patrón se aplica solo a directorios, no a archivos.
|
||||
|
||||
/PATH/FILE
|
||||
Selecciona la ruta de archivo exacta especificada. Puede usar
|
||||
cualquier carácter globbing como * y ?, pero nunca coinciden
|
||||
con una barra de directorio.
|
||||
Este patrón se aplica solo a archivos, no a directorios.
|
||||
Selecciona la ruta exacta del archivo especificado. Este patrón se aplica
|
||||
solo a archivos, no a directorios.
|
||||
|
||||
/PATH/DIR/
|
||||
Selecciona la ruta de directorio exacta especificada y todo
|
||||
lo que contiene. Puede usar cualquier carácter globbing como * y ?,
|
||||
pero nunca coinciden con una barra de directorio.
|
||||
Este patrón se aplica solo a directorios, no a archivos.
|
||||
Selecciona la ruta exacta del directorio especificado y todo lo que hay
|
||||
dentro. Este patrón se aplica solo a directorios, no a archivos.
|
||||
|
||||
Cuando especifica una ruta absoluta que comienza con /, se aplica
|
||||
en el directorio raíz del array, no en el directorio raíz del
|
||||
|
|
|
|||
|
|
@ -1807,34 +1807,60 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH MOTIF (PATTERN)
|
||||
Les motifs sont utilisés pour sélectionner un sous\-ensemble de fichiers
|
||||
à exclure ou à inclure dans le processus.
|
||||
Les motifs offrent un moyen flexible de filtrer les fichiers à inclure ou
|
||||
à exclure. En utilisant des caractères de \[dq]globbing\[dq], vous pouvez définir des règles qui
|
||||
correspondent à des noms de fichiers spécifiques ou à des structures de répertoires entières sans
|
||||
lister chaque chemin manuellement.
|
||||
.PP
|
||||
Le point d\'interrogation \`?\` correspond à n\'importe quel caractère unique, sauf le
|
||||
séparateur de répertoire. Cela le rend utile pour faire correspondre des noms de fichiers avec des
|
||||
caractères variables tout en limitant le motif à un seul niveau de répertoire.
|
||||
.PP
|
||||
L\'étoile simple \`*\` correspond à n\'importe quelle séquence de caractères, mais comme le
|
||||
point d\'interrogation, elle ne traverse jamais les frontières des répertoires. Elle s\'arrête à la
|
||||
barre oblique, ce qui la rend adaptée à la recherche de correspondances au sein d\'un seul
|
||||
composant de chemin. Il s\'agit du comportement standard des jokers familier du
|
||||
\[dq]globbing\[dq] shell.
|
||||
.PP
|
||||
La double étoile \`**\` est plus puissante, elle correspond à n\'importe quelle séquence de
|
||||
caractères, y compris les séparateurs de répertoires. Cela permet aux motifs de correspondre
|
||||
sur plusieurs niveaux de répertoires. Lorsque \`**\` apparaît directement intégré dans
|
||||
un motif, il peut correspondre à zéro ou plusieurs caractères, y compris les barres obliques entre
|
||||
le texte littéral environnant.
|
||||
.PP
|
||||
L\'utilisation la plus importante de \`**\` est sous la forme spéciale \`/**/\`. Celle\-ci correspond à
|
||||
zéro ou plusieurs niveaux de répertoires complets, ce qui permet de faire correspondre des fichiers
|
||||
à n\'importe quelle profondeur dans une arborescence de répertoires sans connaître la structure exacte du chemin.
|
||||
Par exemple, le motif \`src/**/main.js\` correspond à \`src/main.js\` (saut de
|
||||
zéro répertoire), \`src/ui/main.js\` (saut d\'un répertoire), et
|
||||
\`src/ui/components/main.js\` (saut de deux répertoires).
|
||||
.PP
|
||||
Les classes de caractères utilisant des crochets \`[]\` correspondent à un seul caractère d\'un
|
||||
ensemble ou d\'une plage spécifiés. Comme les autres motifs à caractère unique, elles
|
||||
ne correspondent pas aux séparateurs de répertoires. Les classes supportent les plages et la négation à l\'aide
|
||||
d\'un point d\'exclamation.
|
||||
.PP
|
||||
La distinction fondamentale à retenir est que \`*\`, \`?\` et les classes de caractères
|
||||
respectent tous les limites des répertoires et ne correspondent qu\'au sein d\'un seul
|
||||
composant de chemin, alors que \`**\` est le seul motif qui peut correspondre à travers
|
||||
les séparateurs de répertoires.
|
||||
.PP
|
||||
Il existe quatre types de motifs différents :
|
||||
.TP
|
||||
.B FICHIER
|
||||
Sélectionne tout fichier nommé FICHIER. Vous pouvez utiliser
|
||||
tous les caractères de globbing comme * et ?, et les classes de
|
||||
caractères comme [a\-z].
|
||||
.B FILE
|
||||
Sélectionne n\'importe quel fichier nommé FILE.
|
||||
Ce motif s\'applique uniquement aux fichiers, pas aux répertoires.
|
||||
.TP
|
||||
.B DOSSIER/
|
||||
Sélectionne tout répertoire nommé DOSSIER et tout ce qu\'il
|
||||
contient. Vous pouvez utiliser tous les caractères de globbing
|
||||
comme * et ?.
|
||||
.B DIR/
|
||||
Sélectionne n\'importe quel répertoire nommé DIR et tout son contenu.
|
||||
Ce motif s\'applique uniquement aux répertoires, pas aux fichiers.
|
||||
.TP
|
||||
.B /CHEMIN/FICHIER
|
||||
Sélectionne le chemin de fichier exact spécifié. Vous pouvez
|
||||
utiliser tous les caractères de globbing comme * et ?, mais
|
||||
ils ne correspondent jamais à une barre oblique de répertoire.
|
||||
Ce motif s\'applique uniquement aux fichiers, pas aux répertoires.
|
||||
.B /PATH/FILE
|
||||
Sélectionne le chemin exact du fichier spécifié. Ce motif s\'applique
|
||||
uniquement aux fichiers, pas aux répertoires.
|
||||
.TP
|
||||
.B /CHEMIN/DOSSIER/
|
||||
Sélectionne le chemin de répertoire exact spécifié et tout ce qu\'il
|
||||
contient. Vous pouvez utiliser tous les caractères de globbing
|
||||
comme * et ?, mais ils ne correspondent jamais à une barre
|
||||
oblique de répertoire.
|
||||
.B /PATH/DIR/
|
||||
Sélectionne le chemin exact du répertoire spécifié et tout son contenu.
|
||||
Ce motif s\'applique uniquement aux répertoires, pas aux fichiers.
|
||||
.PP
|
||||
Lorsque vous spécifiez un chemin absolu commençant par /, il est
|
||||
|
|
|
|||
|
|
@ -1434,34 +1434,60 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Motif (Pattern)
|
||||
Les motifs sont utilisés pour sélectionner un sous-ensemble de fichiers
|
||||
à exclure ou à inclure dans le processus.
|
||||
Les motifs offrent un moyen flexible de filtrer les fichiers à inclure ou
|
||||
à exclure. En utilisant des caractères de "globbing", vous pouvez définir des règles qui
|
||||
correspondent à des noms de fichiers spécifiques ou à des structures de répertoires entières sans
|
||||
lister chaque chemin manuellement.
|
||||
|
||||
Le point d'interrogation `?` correspond à n'importe quel caractère unique, sauf le
|
||||
séparateur de répertoire. Cela le rend utile pour faire correspondre des noms de fichiers avec des
|
||||
caractères variables tout en limitant le motif à un seul niveau de répertoire.
|
||||
|
||||
L'étoile simple `*` correspond à n'importe quelle séquence de caractères, mais comme le
|
||||
point d'interrogation, elle ne traverse jamais les frontières des répertoires. Elle s'arrête à la
|
||||
barre oblique, ce qui la rend adaptée à la recherche de correspondances au sein d'un seul
|
||||
composant de chemin. Il s'agit du comportement standard des jokers familier du
|
||||
"globbing" shell.
|
||||
|
||||
La double étoile `**` est plus puissante, elle correspond à n'importe quelle séquence de
|
||||
caractères, y compris les séparateurs de répertoires. Cela permet aux motifs de correspondre
|
||||
sur plusieurs niveaux de répertoires. Lorsque `**` apparaît directement intégré dans
|
||||
un motif, il peut correspondre à zéro ou plusieurs caractères, y compris les barres obliques entre
|
||||
le texte littéral environnant.
|
||||
|
||||
L'utilisation la plus importante de `**` est sous la forme spéciale `/**/`. Celle-ci correspond à
|
||||
zéro ou plusieurs niveaux de répertoires complets, ce qui permet de faire correspondre des fichiers
|
||||
à n'importe quelle profondeur dans une arborescence de répertoires sans connaître la structure exacte du chemin.
|
||||
Par exemple, le motif `src/**/main.js` correspond à `src/main.js` (saut de
|
||||
zéro répertoire), `src/ui/main.js` (saut d'un répertoire), et
|
||||
`src/ui/components/main.js` (saut de deux répertoires).
|
||||
|
||||
Les classes de caractères utilisant des crochets `[]` correspondent à un seul caractère d'un
|
||||
ensemble ou d'une plage spécifiés. Comme les autres motifs à caractère unique, elles
|
||||
ne correspondent pas aux séparateurs de répertoires. Les classes supportent les plages et la négation à l'aide
|
||||
d'un point d'exclamation.
|
||||
|
||||
La distinction fondamentale à retenir est que `*`, `?` et les classes de caractères
|
||||
respectent tous les limites des répertoires et ne correspondent qu'au sein d'un seul
|
||||
composant de chemin, alors que `**` est le seul motif qui peut correspondre à travers
|
||||
les séparateurs de répertoires.
|
||||
|
||||
Il existe quatre types de motifs différents :
|
||||
|
||||
=FICHIER
|
||||
Sélectionne tout fichier nommé FICHIER. Vous pouvez utiliser
|
||||
tous les caractères de globbing comme * et ?, et les classes de
|
||||
caractères comme [a-z].
|
||||
=FILE
|
||||
Sélectionne n'importe quel fichier nommé FILE.
|
||||
Ce motif s'applique uniquement aux fichiers, pas aux répertoires.
|
||||
|
||||
=DOSSIER/
|
||||
Sélectionne tout répertoire nommé DOSSIER et tout ce qu'il
|
||||
contient. Vous pouvez utiliser tous les caractères de globbing
|
||||
comme * et ?.
|
||||
=DIR/
|
||||
Sélectionne n'importe quel répertoire nommé DIR et tout son contenu.
|
||||
Ce motif s'applique uniquement aux répertoires, pas aux fichiers.
|
||||
|
||||
=/CHEMIN/FICHIER
|
||||
Sélectionne le chemin de fichier exact spécifié. Vous pouvez
|
||||
utiliser tous les caractères de globbing comme * et ?, mais
|
||||
ils ne correspondent jamais à une barre oblique de répertoire.
|
||||
Ce motif s'applique uniquement aux fichiers, pas aux répertoires.
|
||||
=/PATH/FILE
|
||||
Sélectionne le chemin exact du fichier spécifié. Ce motif s'applique
|
||||
uniquement aux fichiers, pas aux répertoires.
|
||||
|
||||
=/CHEMIN/DOSSIER/
|
||||
Sélectionne le chemin de répertoire exact spécifié et tout ce qu'il
|
||||
contient. Vous pouvez utiliser tous les caractères de globbing
|
||||
comme * et ?, mais ils ne correspondent jamais à une barre
|
||||
oblique de répertoire.
|
||||
=/PATH/DIR/
|
||||
Sélectionne le chemin exact du répertoire spécifié et tout son contenu.
|
||||
Ce motif s'applique uniquement aux répertoires, pas aux fichiers.
|
||||
|
||||
Lorsque vous spécifiez un chemin absolu commençant par /, il est
|
||||
|
|
|
|||
|
|
@ -1533,34 +1533,60 @@ Un exemple de configuration typique pour Windows est :
|
|||
8 MOTIF (PATTERN)
|
||||
=================
|
||||
|
||||
Les motifs sont utilisés pour sélectionner un sous-ensemble de fichiers
|
||||
à exclure ou à inclure dans le processus.
|
||||
Les motifs offrent un moyen flexible de filtrer les fichiers à inclure ou
|
||||
à exclure. En utilisant des caractères de "globbing", vous pouvez définir des règles qui
|
||||
correspondent à des noms de fichiers spécifiques ou à des structures de répertoires entières sans
|
||||
lister chaque chemin manuellement.
|
||||
|
||||
Le point d'interrogation `?` correspond à n'importe quel caractère unique, sauf le
|
||||
séparateur de répertoire. Cela le rend utile pour faire correspondre des noms de fichiers avec des
|
||||
caractères variables tout en limitant le motif à un seul niveau de répertoire.
|
||||
|
||||
L'étoile simple `*` correspond à n'importe quelle séquence de caractères, mais comme le
|
||||
point d'interrogation, elle ne traverse jamais les frontières des répertoires. Elle s'arrête à la
|
||||
barre oblique, ce qui la rend adaptée à la recherche de correspondances au sein d'un seul
|
||||
composant de chemin. Il s'agit du comportement standard des jokers familier du
|
||||
"globbing" shell.
|
||||
|
||||
La double étoile `**` est plus puissante, elle correspond à n'importe quelle séquence de
|
||||
caractères, y compris les séparateurs de répertoires. Cela permet aux motifs de correspondre
|
||||
sur plusieurs niveaux de répertoires. Lorsque `**` apparaît directement intégré dans
|
||||
un motif, il peut correspondre à zéro ou plusieurs caractères, y compris les barres obliques entre
|
||||
le texte littéral environnant.
|
||||
|
||||
L'utilisation la plus importante de `**` est sous la forme spéciale `/**/`. Celle-ci correspond à
|
||||
zéro ou plusieurs niveaux de répertoires complets, ce qui permet de faire correspondre des fichiers
|
||||
à n'importe quelle profondeur dans une arborescence de répertoires sans connaître la structure exacte du chemin.
|
||||
Par exemple, le motif `src/**/main.js` correspond à `src/main.js` (saut de
|
||||
zéro répertoire), `src/ui/main.js` (saut d'un répertoire), et
|
||||
`src/ui/components/main.js` (saut de deux répertoires).
|
||||
|
||||
Les classes de caractères utilisant des crochets `[]` correspondent à un seul caractère d'un
|
||||
ensemble ou d'une plage spécifiés. Comme les autres motifs à caractère unique, elles
|
||||
ne correspondent pas aux séparateurs de répertoires. Les classes supportent les plages et la négation à l'aide
|
||||
d'un point d'exclamation.
|
||||
|
||||
La distinction fondamentale à retenir est que `*`, `?` et les classes de caractères
|
||||
respectent tous les limites des répertoires et ne correspondent qu'au sein d'un seul
|
||||
composant de chemin, alors que `**` est le seul motif qui peut correspondre à travers
|
||||
les séparateurs de répertoires.
|
||||
|
||||
Il existe quatre types de motifs différents :
|
||||
|
||||
FICHIER
|
||||
Sélectionne tout fichier nommé FICHIER. Vous pouvez utiliser
|
||||
tous les caractères de globbing comme * et ?, et les classes de
|
||||
caractères comme [a-z].
|
||||
FILE
|
||||
Sélectionne n'importe quel fichier nommé FILE.
|
||||
Ce motif s'applique uniquement aux fichiers, pas aux répertoires.
|
||||
|
||||
DOSSIER/
|
||||
Sélectionne tout répertoire nommé DOSSIER et tout ce qu'il
|
||||
contient. Vous pouvez utiliser tous les caractères de globbing
|
||||
comme * et ?.
|
||||
DIR/
|
||||
Sélectionne n'importe quel répertoire nommé DIR et tout son contenu.
|
||||
Ce motif s'applique uniquement aux répertoires, pas aux fichiers.
|
||||
|
||||
/CHEMIN/FICHIER
|
||||
Sélectionne le chemin de fichier exact spécifié. Vous pouvez
|
||||
utiliser tous les caractères de globbing comme * et ?, mais
|
||||
ils ne correspondent jamais à une barre oblique de répertoire.
|
||||
Ce motif s'applique uniquement aux fichiers, pas aux répertoires.
|
||||
/PATH/FILE
|
||||
Sélectionne le chemin exact du fichier spécifié. Ce motif s'applique
|
||||
uniquement aux fichiers, pas aux répertoires.
|
||||
|
||||
/CHEMIN/DOSSIER/
|
||||
Sélectionne le chemin de répertoire exact spécifié et tout ce qu'il
|
||||
contient. Vous pouvez utiliser tous les caractères de globbing
|
||||
comme * et ?, mais ils ne correspondent jamais à une barre
|
||||
oblique de répertoire.
|
||||
/PATH/DIR/
|
||||
Sélectionne le chemin exact du répertoire spécifié et tout son contenu.
|
||||
Ce motif s'applique uniquement aux répertoires, pas aux fichiers.
|
||||
|
||||
Lorsque vous spécifiez un chemin absolu commençant par /, il est
|
||||
|
|
|
|||
|
|
@ -1793,35 +1793,61 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
I pattern vengono utilizzati per selezionare un sottoinsieme di file da
|
||||
escludere o includere nel processo.
|
||||
I pattern offrono un modo flessibile per filtrare i file da includere o
|
||||
escludere. Usando i caratteri globbing, è possibile definire regole che
|
||||
corrispondano a nomi di file specifici o a intere strutture di directory senza
|
||||
elencare manualmente ogni percorso.
|
||||
.PP
|
||||
Il punto interrogativo \`?\` corrisponde a qualsiasi carattere singolo eccetto il
|
||||
separatore di directory. Questo lo rende utile per far corrispondere nomi di file
|
||||
con caratteri variabili mantenendo il pattern confinato a un singolo livello di directory.
|
||||
.PP
|
||||
L\'asterisco singolo \`*\` corrisponde a qualsiasi sequenza di caratteri, ma come il
|
||||
punto interrogativo, non attraversa mai i confini delle directory. Si ferma allo
|
||||
slash in avanti, rendendolo adatto per la corrispondenza all\'interno di un singolo
|
||||
componente del percorso. Questo è il comportamento standard dei wildcard familiare
|
||||
dal globbing della shell.
|
||||
.PP
|
||||
Il doppio asterisco \`**\` è più potente, corrisponde a qualsiasi sequenza di
|
||||
caratteri inclusi i separatori di directory. Ciò consente ai pattern di corrispondere
|
||||
attraverso più livelli di directory. Quando \`**\` appare inserito direttamente in
|
||||
un pattern, può corrispondere a zero o più caratteri inclusi gli slash tra
|
||||
il testo letterale circostante.
|
||||
.PP
|
||||
L\'uso più importante di \`**\` è nella forma speciale \`/**/\`. Questa corrisponde a
|
||||
zero o più livelli di directory completi, rendendo possibile la corrispondenza di file
|
||||
a qualsiasi profondità in un albero di directory senza conoscere l\'esatta struttura del percorso.
|
||||
Per esempio, il pattern \`src/**/main.js\` corrisponde a \`src/main.js\` (saltando
|
||||
zero directory), \`src/ui/main.js\` (saltando una directory), e
|
||||
\`src/ui/components/main.js\` (saltando due directory).
|
||||
.PP
|
||||
Le classi di caratteri che usano le parentesi quadre \`[]\` corrispondono a un singolo carattere da un
|
||||
set o intervallo specificato. Come gli altri pattern a carattere singolo, esse
|
||||
non corrispondono ai separatori di directory. Le classi supportano intervalli e la negazione usando
|
||||
un punto esclamativo.
|
||||
.PP
|
||||
La distinzione fondamentale da ricordare è che \`*\`, \`?\` e le classi di caratteri
|
||||
rispettano tutti i confini delle directory e corrispondono solo all\'interno di un singolo
|
||||
componente del percorso, mentre \`**\` è l\'unico pattern che può corrispondere attraverso
|
||||
i separatori di directory.
|
||||
.PP
|
||||
Esistono quattro diversi tipi di pattern:
|
||||
.TP
|
||||
.B FILE
|
||||
Seleziona qualsiasi file denominato FILE. È possibile utilizzare
|
||||
qualsiasi carattere di globbing come * e ?, e classi di caratteri
|
||||
come [a\-z].
|
||||
Seleziona qualsiasi file chiamato FILE.
|
||||
Questo pattern si applica solo ai file, non alle directory.
|
||||
.TP
|
||||
.B DIR/
|
||||
Seleziona qualsiasi directory denominata DIR e tutto ciò che è
|
||||
al suo interno. È possibile utilizzare qualsiasi carattere di
|
||||
globbing come * e ?.
|
||||
Seleziona qualsiasi directory chiamata DIR e tutto ciò che contiene.
|
||||
Questo pattern si applica solo alle directory, non ai file.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Seleziona l\'esatto percorso del file specificato. È possibile
|
||||
utilizzare qualsiasi carattere di globbing come * e ?, ma non
|
||||
corrispondono mai a uno slash di directory.
|
||||
Questo pattern si applica solo ai file, non alle directory.
|
||||
Seleziona l\'esatto percorso del file specificato. Questo pattern si applica
|
||||
solo ai file, non alle directory.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Seleziona l\'esatto percorso della directory specificata e tutto
|
||||
ciò che è al suo interno. È possibile utilizzare qualsiasi
|
||||
carattere di globbing come * e ?, ma non corrispondono mai a
|
||||
uno slash di directory.
|
||||
Questo pattern si aplica solo alle directory, non ai file.
|
||||
Seleziona l\'esatto percorso della directory specificata e tutto ciò che
|
||||
contiene. Questo pattern si applica solo alle directory, non ai file.
|
||||
.PP
|
||||
Quando si specifica un percorso assoluto che inizia con /, viene
|
||||
applicato alla directory radice dell\'array, non alla directory radice
|
||||
|
|
|
|||
|
|
@ -1409,35 +1409,61 @@ Configurazione
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
I pattern vengono utilizzati per selezionare un sottoinsieme di file da
|
||||
escludere o includere nel processo.
|
||||
I pattern offrono un modo flessibile per filtrare i file da includere o
|
||||
escludere. Usando i caratteri globbing, è possibile definire regole che
|
||||
corrispondano a nomi di file specifici o a intere strutture di directory senza
|
||||
elencare manualmente ogni percorso.
|
||||
|
||||
Il punto interrogativo `?` corrisponde a qualsiasi carattere singolo eccetto il
|
||||
separatore di directory. Questo lo rende utile per far corrispondere nomi di file
|
||||
con caratteri variabili mantenendo il pattern confinato a un singolo livello di directory.
|
||||
|
||||
L'asterisco singolo `*` corrisponde a qualsiasi sequenza di caratteri, ma come il
|
||||
punto interrogativo, non attraversa mai i confini delle directory. Si ferma allo
|
||||
slash in avanti, rendendolo adatto per la corrispondenza all'interno di un singolo
|
||||
componente del percorso. Questo è il comportamento standard dei wildcard familiare
|
||||
dal globbing della shell.
|
||||
|
||||
Il doppio asterisco `**` è più potente, corrisponde a qualsiasi sequenza di
|
||||
caratteri inclusi i separatori di directory. Ciò consente ai pattern di corrispondere
|
||||
attraverso più livelli di directory. Quando `**` appare inserito direttamente in
|
||||
un pattern, può corrispondere a zero o più caratteri inclusi gli slash tra
|
||||
il testo letterale circostante.
|
||||
|
||||
L'uso più importante di `**` è nella forma speciale `/**/`. Questa corrisponde a
|
||||
zero o più livelli di directory completi, rendendo possibile la corrispondenza di file
|
||||
a qualsiasi profondità in un albero di directory senza conoscere l'esatta struttura del percorso.
|
||||
Per esempio, il pattern `src/**/main.js` corrisponde a `src/main.js` (saltando
|
||||
zero directory), `src/ui/main.js` (saltando una directory), e
|
||||
`src/ui/components/main.js` (saltando due directory).
|
||||
|
||||
Le classi di caratteri che usano le parentesi quadre `[]` corrispondono a un singolo carattere da un
|
||||
set o intervallo specificato. Come gli altri pattern a carattere singolo, esse
|
||||
non corrispondono ai separatori di directory. Le classi supportano intervalli e la negazione usando
|
||||
un punto esclamativo.
|
||||
|
||||
La distinzione fondamentale da ricordare è che `*`, `?` e le classi di caratteri
|
||||
rispettano tutti i confini delle directory e corrispondono solo all'interno di un singolo
|
||||
componente del percorso, mentre `**` è l'unico pattern che può corrispondere attraverso
|
||||
i separatori di directory.
|
||||
|
||||
Esistono quattro diversi tipi di pattern:
|
||||
|
||||
=FILE
|
||||
Seleziona qualsiasi file denominato FILE. È possibile utilizzare
|
||||
qualsiasi carattere di globbing come * e ?, e classi di caratteri
|
||||
come [a-z].
|
||||
Seleziona qualsiasi file chiamato FILE.
|
||||
Questo pattern si applica solo ai file, non alle directory.
|
||||
|
||||
=DIR/
|
||||
Seleziona qualsiasi directory denominata DIR e tutto ciò che è
|
||||
al suo interno. È possibile utilizzare qualsiasi carattere di
|
||||
globbing come * e ?.
|
||||
Seleziona qualsiasi directory chiamata DIR e tutto ciò che contiene.
|
||||
Questo pattern si applica solo alle directory, non ai file.
|
||||
|
||||
=/PATH/FILE
|
||||
Seleziona l'esatto percorso del file specificato. È possibile
|
||||
utilizzare qualsiasi carattere di globbing come * e ?, ma non
|
||||
corrispondono mai a uno slash di directory.
|
||||
Questo pattern si applica solo ai file, non alle directory.
|
||||
Seleziona l'esatto percorso del file specificato. Questo pattern si applica
|
||||
solo ai file, non alle directory.
|
||||
|
||||
=/PATH/DIR/
|
||||
Seleziona l'esatto percorso della directory specificata e tutto
|
||||
ciò che è al suo interno. È possibile utilizzare qualsiasi
|
||||
carattere di globbing come * e ?, ma non corrispondono mai a
|
||||
uno slash di directory.
|
||||
Questo pattern si aplica solo alle directory, non ai file.
|
||||
Seleziona l'esatto percorso della directory specificata e tutto ciò che
|
||||
contiene. Questo pattern si applica solo alle directory, non ai file.
|
||||
|
||||
Quando si specifica un percorso assoluto che inizia con /, viene
|
||||
applicato alla directory radice dell'array, non alla directory radice
|
||||
|
|
|
|||
|
|
@ -1508,35 +1508,61 @@ Un esempio di configurazione tipica per Windows è:
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
I pattern vengono utilizzati per selezionare un sottoinsieme di file da
|
||||
escludere o includere nel processo.
|
||||
I pattern offrono un modo flessibile per filtrare i file da includere o
|
||||
escludere. Usando i caratteri globbing, è possibile definire regole che
|
||||
corrispondano a nomi di file specifici o a intere strutture di directory senza
|
||||
elencare manualmente ogni percorso.
|
||||
|
||||
Il punto interrogativo `?` corrisponde a qualsiasi carattere singolo eccetto il
|
||||
separatore di directory. Questo lo rende utile per far corrispondere nomi di file
|
||||
con caratteri variabili mantenendo il pattern confinato a un singolo livello di directory.
|
||||
|
||||
L'asterisco singolo `*` corrisponde a qualsiasi sequenza di caratteri, ma come il
|
||||
punto interrogativo, non attraversa mai i confini delle directory. Si ferma allo
|
||||
slash in avanti, rendendolo adatto per la corrispondenza all'interno di un singolo
|
||||
componente del percorso. Questo è il comportamento standard dei wildcard familiare
|
||||
dal globbing della shell.
|
||||
|
||||
Il doppio asterisco `**` è più potente, corrisponde a qualsiasi sequenza di
|
||||
caratteri inclusi i separatori di directory. Ciò consente ai pattern di corrispondere
|
||||
attraverso più livelli di directory. Quando `**` appare inserito direttamente in
|
||||
un pattern, può corrispondere a zero o più caratteri inclusi gli slash tra
|
||||
il testo letterale circostante.
|
||||
|
||||
L'uso più importante di `**` è nella forma speciale `/**/`. Questa corrisponde a
|
||||
zero o più livelli di directory completi, rendendo possibile la corrispondenza di file
|
||||
a qualsiasi profondità in un albero di directory senza conoscere l'esatta struttura del percorso.
|
||||
Per esempio, il pattern `src/**/main.js` corrisponde a `src/main.js` (saltando
|
||||
zero directory), `src/ui/main.js` (saltando una directory), e
|
||||
`src/ui/components/main.js` (saltando due directory).
|
||||
|
||||
Le classi di caratteri che usano le parentesi quadre `[]` corrispondono a un singolo carattere da un
|
||||
set o intervallo specificato. Come gli altri pattern a carattere singolo, esse
|
||||
non corrispondono ai separatori di directory. Le classi supportano intervalli e la negazione usando
|
||||
un punto esclamativo.
|
||||
|
||||
La distinzione fondamentale da ricordare è che `*`, `?` e le classi di caratteri
|
||||
rispettano tutti i confini delle directory e corrispondono solo all'interno di un singolo
|
||||
componente del percorso, mentre `**` è l'unico pattern che può corrispondere attraverso
|
||||
i separatori di directory.
|
||||
|
||||
Esistono quattro diversi tipi di pattern:
|
||||
|
||||
FILE
|
||||
Seleziona qualsiasi file denominato FILE. È possibile utilizzare
|
||||
qualsiasi carattere di globbing come * e ?, e classi di caratteri
|
||||
come [a-z].
|
||||
Seleziona qualsiasi file chiamato FILE.
|
||||
Questo pattern si applica solo ai file, non alle directory.
|
||||
|
||||
DIR/
|
||||
Seleziona qualsiasi directory denominata DIR e tutto ciò che è
|
||||
al suo interno. È possibile utilizzare qualsiasi carattere di
|
||||
globbing come * e ?.
|
||||
Seleziona qualsiasi directory chiamata DIR e tutto ciò che contiene.
|
||||
Questo pattern si applica solo alle directory, non ai file.
|
||||
|
||||
/PATH/FILE
|
||||
Seleziona l'esatto percorso del file specificato. È possibile
|
||||
utilizzare qualsiasi carattere di globbing come * e ?, ma non
|
||||
corrispondono mai a uno slash di directory.
|
||||
Questo pattern si applica solo ai file, non alle directory.
|
||||
Seleziona l'esatto percorso del file specificato. Questo pattern si applica
|
||||
solo ai file, non alle directory.
|
||||
|
||||
/PATH/DIR/
|
||||
Seleziona l'esatto percorso della directory specificata e tutto
|
||||
ciò che è al suo interno. È possibile utilizzare qualsiasi
|
||||
carattere di globbing come * e ?, ma non corrispondono mai a
|
||||
uno slash di directory.
|
||||
Questo pattern si aplica solo alle directory, non ai file.
|
||||
Seleziona l'esatto percorso della directory specificata e tutto ciò che
|
||||
contiene. Questo pattern si applica solo alle directory, non ai file.
|
||||
|
||||
Quando si specifica un percorso assoluto che inizia con /, viene
|
||||
applicato alla directory radice dell'array, non alla directory radice
|
||||
|
|
|
|||
|
|
@ -1601,29 +1601,57 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
パターンは、プロセスで除外または含めるファイルのサブセットを選択するために使用されます。
|
||||
パターンは、含めるファイルまたは除外するファイルをフィルタリングするための柔軟な方法を
|
||||
提供します。グロブ文字を使用することで、すべてのパスを手動でリストすることなく、
|
||||
特定のファイル名やディレクトリ構造全体に一致するルールを定義できます。
|
||||
.PP
|
||||
疑問符 \`?\` は、ディレクトリ区切り文字を除く任意の1文字に一致します。
|
||||
これにより、パターンを単一のディレクトリレベルに限定したまま、可変文字を
|
||||
持つファイル名と一致させるのに役立ちます。
|
||||
.PP
|
||||
単一のアスタリスク \`*\` は任意の文字列に一致しますが、疑問符と同様に
|
||||
ディレクトリの境界を越えることはありません。スラッシュで停止するため、
|
||||
単一のパスコンポーネント内での一致に適しています。これは、シェルの
|
||||
グロブでおなじみの標準的なワイルドカードの動作です。
|
||||
.PP
|
||||
ダブルアスタリスク \`**\` はより強力で、ディレクトリ区切り文字を含む
|
||||
任意の文字列に一致します。これにより、パターンが複数のディレクトリレベルを
|
||||
またいで一致できるようになります。\`**\` がパターン内に直接埋め込まれている場合、
|
||||
周囲のリテラルテキストの間にあるスラッシュを含む0文字以上の文字に一致します。
|
||||
.PP
|
||||
\`**\` の最も重要な使い方は、特別な形式である \`/**/\` です。これは
|
||||
0個以上の完全なディレクトリレベルに一致し、正確なパス構造を知らなくても、
|
||||
ディレクトリツリー内の任意の深さにあるファイルと一致させることができます。
|
||||
例えば、パターン \`src/**/main.js\` は \`src/main.js\`(ディレクトリを0個スキップ)、
|
||||
\`src/ui/main.js\`(1個スキップ)、\`src/ui/components/main.js\`(2個スキップ)
|
||||
に一致します。
|
||||
.PP
|
||||
角括弧 \`[]\` を使用した文字クラスは、指定されたセットまたは範囲の
|
||||
任意の1文字に一致します。他の単一文字パターンと同様に、
|
||||
ディレクトリ区切り文字には一致しません。クラスは範囲と、感嘆符を
|
||||
使用した否定をサポートしています。
|
||||
.PP
|
||||
覚えておくべき根本的な違いは、\`*\`、\`?\`、および文字クラスはすべて
|
||||
ディレクトリの境界を尊重し、単一のパスコンポーネント内でのみ一致するのに対し、
|
||||
\`**\` はディレクトリ区切り文字をまたいで一致できる唯一のパターンであるということです。
|
||||
.PP
|
||||
4つの異なる種類のパターンがあります。
|
||||
.TP
|
||||
.B FILE
|
||||
FILE という名前の任意のファイルを選択します。* や ? などのグロブ文字、
|
||||
および [a\-z] などの文字クラスを使用できます。
|
||||
このパターンは**ファイルのみ**に適用され、ディレクトリには適用されません。
|
||||
FILE という名前の任意のファイルを選択します。
|
||||
このパターンはファイルにのみ適用され、ディレクトリには適用されません。
|
||||
.TP
|
||||
.B DIR/
|
||||
DIR という名前の任意のディレクトリと、その中のすべてを選択します。
|
||||
* や ? などのグロブ文字を使用できます。
|
||||
このパターンは**ディレクトリのみ**に適用され、ファイルには適用されません。
|
||||
DIR という名前の任意のディレクトリとその中のすべてを選択します。
|
||||
このパターンはディレクトリにのみ適用され、ファイルには適用されません。
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
正確に指定されたファイルパスを選択します。* や ? などのグロブ文字を
|
||||
使用できますが、**ディレクトリスラッシュには一致しません**。
|
||||
このパターンは**ファイルのみ**に適用され、ディレクトリには適用されません。
|
||||
指定された正確なファイル パスを選択します。このパターンは
|
||||
ファイルにのみ適用され、ディレクトリには適用されません。
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
正確に指定されたディレクトリパスと、その中のすべてを選択します。* や ? などの
|
||||
グロブ文字を使用できますが、**ディレクトリスラッシュには一致しません**。
|
||||
このパターンは**ディレクトリのみ**に適用され、ファイルには適用されません。
|
||||
指定された正確なディレクトリ パスとその中のすべてを選択します。
|
||||
このパターンはディレクトリにのみ適用され、ファイルには適用されません。
|
||||
.TP
|
||||
.B / で始まる絶対パスを指定する場合、それはローカルファイルシステムのルートディレクトリではなく、
|
||||
**アレイのルートディレクトリ**に適用されます。
|
||||
|
|
|
|||
|
|
@ -1228,29 +1228,57 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
パターンは、プロセスで除外または含めるファイルのサブセットを選択するために使用されます。
|
||||
パターンは、含めるファイルまたは除外するファイルをフィルタリングするための柔軟な方法を
|
||||
提供します。グロブ文字を使用することで、すべてのパスを手動でリストすることなく、
|
||||
特定のファイル名やディレクトリ構造全体に一致するルールを定義できます。
|
||||
|
||||
疑問符 `?` は、ディレクトリ区切り文字を除く任意の1文字に一致します。
|
||||
これにより、パターンを単一のディレクトリレベルに限定したまま、可変文字を
|
||||
持つファイル名と一致させるのに役立ちます。
|
||||
|
||||
単一のアスタリスク `*` は任意の文字列に一致しますが、疑問符と同様に
|
||||
ディレクトリの境界を越えることはありません。スラッシュで停止するため、
|
||||
単一のパスコンポーネント内での一致に適しています。これは、シェルの
|
||||
グロブでおなじみの標準的なワイルドカードの動作です。
|
||||
|
||||
ダブルアスタリスク `**` はより強力で、ディレクトリ区切り文字を含む
|
||||
任意の文字列に一致します。これにより、パターンが複数のディレクトリレベルを
|
||||
またいで一致できるようになります。`**` がパターン内に直接埋め込まれている場合、
|
||||
周囲のリテラルテキストの間にあるスラッシュを含む0文字以上の文字に一致します。
|
||||
|
||||
`**` の最も重要な使い方は、特別な形式である `/**/` です。これは
|
||||
0個以上の完全なディレクトリレベルに一致し、正確なパス構造を知らなくても、
|
||||
ディレクトリツリー内の任意の深さにあるファイルと一致させることができます。
|
||||
例えば、パターン `src/**/main.js` は `src/main.js`(ディレクトリを0個スキップ)、
|
||||
`src/ui/main.js`(1個スキップ)、`src/ui/components/main.js`(2個スキップ)
|
||||
に一致します。
|
||||
|
||||
角括弧 `[]` を使用した文字クラスは、指定されたセットまたは範囲の
|
||||
任意の1文字に一致します。他の単一文字パターンと同様に、
|
||||
ディレクトリ区切り文字には一致しません。クラスは範囲と、感嘆符を
|
||||
使用した否定をサポートしています。
|
||||
|
||||
覚えておくべき根本的な違いは、`*`、`?`、および文字クラスはすべて
|
||||
ディレクトリの境界を尊重し、単一のパスコンポーネント内でのみ一致するのに対し、
|
||||
`**` はディレクトリ区切り文字をまたいで一致できる唯一のパターンであるということです。
|
||||
|
||||
4つの異なる種類のパターンがあります。
|
||||
|
||||
=FILE
|
||||
FILE という名前の任意のファイルを選択します。* や ? などのグロブ文字、
|
||||
および [a-z] などの文字クラスを使用できます。
|
||||
このパターンは**ファイルのみ**に適用され、ディレクトリには適用されません。
|
||||
FILE という名前の任意のファイルを選択します。
|
||||
このパターンはファイルにのみ適用され、ディレクトリには適用されません。
|
||||
|
||||
=DIR/
|
||||
DIR という名前の任意のディレクトリと、その中のすべてを選択します。
|
||||
* や ? などのグロブ文字を使用できます。
|
||||
このパターンは**ディレクトリのみ**に適用され、ファイルには適用されません。
|
||||
DIR という名前の任意のディレクトリとその中のすべてを選択します。
|
||||
このパターンはディレクトリにのみ適用され、ファイルには適用されません。
|
||||
|
||||
=/PATH/FILE
|
||||
正確に指定されたファイルパスを選択します。* や ? などのグロブ文字を
|
||||
使用できますが、**ディレクトリスラッシュには一致しません**。
|
||||
このパターンは**ファイルのみ**に適用され、ディレクトリには適用されません。
|
||||
指定された正確なファイル パスを選択します。このパターンは
|
||||
ファイルにのみ適用され、ディレクトリには適用されません。
|
||||
|
||||
=/PATH/DIR/
|
||||
正確に指定されたディレクトリパスと、その中のすべてを選択します。* や ? などの
|
||||
グロブ文字を使用できますが、**ディレクトリスラッシュには一致しません**。
|
||||
このパターンは**ディレクトリのみ**に適用され、ファイルには適用されません。
|
||||
指定された正確なディレクトリ パスとその中のすべてを選択します。
|
||||
このパターンはディレクトリにのみ適用され、ファイルには適用されません。
|
||||
|
||||
/ で始まる絶対パスを指定する場合、それはローカルファイルシステムのルートディレクトリではなく、
|
||||
**アレイのルートディレクトリ**に適用されます。
|
||||
|
|
|
|||
|
|
@ -1327,29 +1327,57 @@ Windowsの一般的な構成の例は次のとおりです。
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
パターンは、プロセスで除外または含めるファイルのサブセットを選択するために使用されます。
|
||||
パターンは、含めるファイルまたは除外するファイルをフィルタリングするための柔軟な方法を
|
||||
提供します。グロブ文字を使用することで、すべてのパスを手動でリストすることなく、
|
||||
特定のファイル名やディレクトリ構造全体に一致するルールを定義できます。
|
||||
|
||||
疑問符 `?` は、ディレクトリ区切り文字を除く任意の1文字に一致します。
|
||||
これにより、パターンを単一のディレクトリレベルに限定したまま、可変文字を
|
||||
持つファイル名と一致させるのに役立ちます。
|
||||
|
||||
単一のアスタリスク `*` は任意の文字列に一致しますが、疑問符と同様に
|
||||
ディレクトリの境界を越えることはありません。スラッシュで停止するため、
|
||||
単一のパスコンポーネント内での一致に適しています。これは、シェルの
|
||||
グロブでおなじみの標準的なワイルドカードの動作です。
|
||||
|
||||
ダブルアスタリスク `**` はより強力で、ディレクトリ区切り文字を含む
|
||||
任意の文字列に一致します。これにより、パターンが複数のディレクトリレベルを
|
||||
またいで一致できるようになります。`**` がパターン内に直接埋め込まれている場合、
|
||||
周囲のリテラルテキストの間にあるスラッシュを含む0文字以上の文字に一致します。
|
||||
|
||||
`**` の最も重要な使い方は、特別な形式である `/**/` です。これは
|
||||
0個以上の完全なディレクトリレベルに一致し、正確なパス構造を知らなくても、
|
||||
ディレクトリツリー内の任意の深さにあるファイルと一致させることができます。
|
||||
例えば、パターン `src/**/main.js` は `src/main.js`(ディレクトリを0個スキップ)、
|
||||
`src/ui/main.js`(1個スキップ)、`src/ui/components/main.js`(2個スキップ)
|
||||
に一致します。
|
||||
|
||||
角括弧 `[]` を使用した文字クラスは、指定されたセットまたは範囲の
|
||||
任意の1文字に一致します。他の単一文字パターンと同様に、
|
||||
ディレクトリ区切り文字には一致しません。クラスは範囲と、感嘆符を
|
||||
使用した否定をサポートしています。
|
||||
|
||||
覚えておくべき根本的な違いは、`*`、`?`、および文字クラスはすべて
|
||||
ディレクトリの境界を尊重し、単一のパスコンポーネント内でのみ一致するのに対し、
|
||||
`**` はディレクトリ区切り文字をまたいで一致できる唯一のパターンであるということです。
|
||||
|
||||
4つの異なる種類のパターンがあります。
|
||||
|
||||
FILE
|
||||
FILE という名前の任意のファイルを選択します。* や ? などのグロブ文字、
|
||||
および [a-z] などの文字クラスを使用できます。
|
||||
このパターンは**ファイルのみ**に適用され、ディレクトリには適用されません。
|
||||
FILE という名前の任意のファイルを選択します。
|
||||
このパターンはファイルにのみ適用され、ディレクトリには適用されません。
|
||||
|
||||
DIR/
|
||||
DIR という名前の任意のディレクトリと、その中のすべてを選択します。
|
||||
* や ? などのグロブ文字を使用できます。
|
||||
このパターンは**ディレクトリのみ**に適用され、ファイルには適用されません。
|
||||
DIR という名前の任意のディレクトリとその中のすべてを選択します。
|
||||
このパターンはディレクトリにのみ適用され、ファイルには適用されません。
|
||||
|
||||
/PATH/FILE
|
||||
正確に指定されたファイルパスを選択します。* や ? などのグロブ文字を
|
||||
使用できますが、**ディレクトリスラッシュには一致しません**。
|
||||
このパターンは**ファイルのみ**に適用され、ディレクトリには適用されません。
|
||||
指定された正確なファイル パスを選択します。このパターンは
|
||||
ファイルにのみ適用され、ディレクトリには適用されません。
|
||||
|
||||
/PATH/DIR/
|
||||
正確に指定されたディレクトリパスと、その中のすべてを選択します。* や ? などの
|
||||
グロブ文字を使用できますが、**ディレクトリスラッシュには一致しません**。
|
||||
このパターンは**ディレクトリのみ**に適用され、ファイルには適用されません。
|
||||
指定された正確なディレクトリ パスとその中のすべてを選択します。
|
||||
このパターンはディレクトリにのみ適用され、ファイルには適用されません。
|
||||
|
||||
/ で始まる絶対パスを指定する場合、それはローカルファイルシステムのルートディレクトリではなく、
|
||||
**アレイのルートディレクトリ**に適用されます。
|
||||
|
|
|
|||
|
|
@ -1649,30 +1649,56 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
패턴은 처리에서 제외하거나 포함할 파일의 하위 집합을 선택하는 데
|
||||
사용됩니다.
|
||||
패턴은 포함하거나 제외할 파일을 필터링하는 유연한 방법을 제공합니다.
|
||||
글로빙(globbing) 문자를 사용하면 모든 경로를 일일이 나열하지 않고도
|
||||
특정 파일 이름이나 전체 디렉토리 구조와 일치하는 규칙을 정의할 수 있습니다.
|
||||
.PP
|
||||
물음표 \`?\`는 디렉토리 구분 기호를 제외한 모든 단일 문자와 일치합니다.
|
||||
이는 패턴을 단일 디렉토리 수준으로 제한하면서 가변 문자가 포함된
|
||||
파일 이름을 일치시키는 데 유용합니다.
|
||||
.PP
|
||||
단일 별표 \`*\`는 모든 문자 시퀀스와 일치하지만, 물음표와 마찬가지로
|
||||
디렉토리 경계를 넘지 않습니다. 슬래시에서 멈추므로 단일 경로 구성 요소
|
||||
내에서의 일치에 적합합니다. 이는 쉘 글로빙에서 익숙한 표준 와일드카드
|
||||
동작입니다.
|
||||
.PP
|
||||
이중 별표 \`**\`는 더 강력하며 디렉토리 구분 기호를 포함한 모든 문자
|
||||
시퀀스와 일치합니다. 이를 통해 패턴이 여러 디렉토리 수준에서 일치할 수
|
||||
있습니다. \`**\`가 패턴 내에 직접 포함된 경우, 주변 리터럴 텍스트 사이의
|
||||
슬래시를 포함하여 0개 이상의 문자와 일치할 수 있습니다.
|
||||
.PP
|
||||
\`**\`의 가장 중요한 용도는 특수 형식인 \`/**/\`입니다. 이는 0개 이상의
|
||||
전체 디렉토리 수준과 일치하므로 정확한 경로 구조를 모르더라도
|
||||
디렉토리 트리의 모든 깊이에서 파일과 일치시킬 수 있습니다.
|
||||
예를 들어, \`src/**/main.js\` 패턴은 \`src/main.js\`(0개의 디렉토리 건너뜀),
|
||||
\`src/ui/main.js\`(1개의 디렉토리 건너뜀), \`src/ui/components/main.js\`
|
||||
(2개의 디렉토리 건너뜀)와 일치합니다.
|
||||
.PP
|
||||
대괄호 \`[]\`를 사용하는 문자 클래스는 지정된 세트 또는 범위에서
|
||||
단일 문자와 일치합니다. 다른 단일 문자 패턴과 마찬가지로 디렉토리
|
||||
구분 기호와는 일치하지 않습니다. 클래스는 범위 및 느낌표를 사용한
|
||||
부정을 지원합니다.
|
||||
.PP
|
||||
기억해야 할 근본적인 차이점은 \`*\`, \`?\` 및 문자 클래스는 모두
|
||||
디렉토리 경계를 준수하고 단일 경로 구성 요소 내에서만 일치하는 반면,
|
||||
\`**\`는 디렉토리 구분 기호를 가로질러 일치할 수 있는 유일한 패턴이라는 것입니다.
|
||||
.PP
|
||||
네 가지 유형의 패턴이 있습니다:
|
||||
.TP
|
||||
.B FILE
|
||||
FILE이라는 이름의 모든 파일을 선택합니다. *, ?와 같은 글로빙
|
||||
문자와 [a\-z]와 같은 문자 클래스를 사용할 수 있습니다.
|
||||
FILE이라는 이름의 모든 파일을 선택합니다.
|
||||
이 패턴은 디렉토리가 아닌 파일에만 적용됩니다.
|
||||
.TP
|
||||
.B DIR/
|
||||
DIR이라는 이름의 모든 디렉토리와 그 안의 모든 것을 선택합니다.
|
||||
*, ?와 같은 글로빙 문자를 사용할 수 있습니다.
|
||||
이 패턴은 파일이 아닌 디렉토리에만 적용됩니다.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
정확히 지정된 파일 경로를 선택합니다. *, ?와 같은 글로빙
|
||||
문자를 사용할 수 있지만, 디렉토리 슬래시와는 절대 일치하지 않습니다.
|
||||
이 패턴은 디렉토리가 아닌 파일에만 적용됩니다.
|
||||
지정된 정확한 파일 경로를 선택합니다. 이 패턴은 디렉토리가 아닌
|
||||
파일에만 적용됩니다.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
정확히 지정된 디렉토리 경로와 그 안의 모든 것을 선택합니다.
|
||||
*, ?와 같은 글로빙 문자를 사용할 수 있지만, 디렉토리 슬래시와는
|
||||
절대 일치하지 않습니다.
|
||||
지정된 정확한 디렉토리 경로와 그 안의 모든 것을 선택합니다.
|
||||
이 패턴은 파일이 아닌 디렉토리에만 적용됩니다.
|
||||
.TP
|
||||
.B /로 시작하는 절대 경로를 지정하면 로컬 파일 시스템의 루트 디렉토리가
|
||||
|
|
|
|||
|
|
@ -1276,30 +1276,56 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
패턴은 처리에서 제외하거나 포함할 파일의 하위 집합을 선택하는 데
|
||||
사용됩니다.
|
||||
패턴은 포함하거나 제외할 파일을 필터링하는 유연한 방법을 제공합니다.
|
||||
글로빙(globbing) 문자를 사용하면 모든 경로를 일일이 나열하지 않고도
|
||||
특정 파일 이름이나 전체 디렉토리 구조와 일치하는 규칙을 정의할 수 있습니다.
|
||||
|
||||
물음표 `?`는 디렉토리 구분 기호를 제외한 모든 단일 문자와 일치합니다.
|
||||
이는 패턴을 단일 디렉토리 수준으로 제한하면서 가변 문자가 포함된
|
||||
파일 이름을 일치시키는 데 유용합니다.
|
||||
|
||||
단일 별표 `*`는 모든 문자 시퀀스와 일치하지만, 물음표와 마찬가지로
|
||||
디렉토리 경계를 넘지 않습니다. 슬래시에서 멈추므로 단일 경로 구성 요소
|
||||
내에서의 일치에 적합합니다. 이는 쉘 글로빙에서 익숙한 표준 와일드카드
|
||||
동작입니다.
|
||||
|
||||
이중 별표 `**`는 더 강력하며 디렉토리 구분 기호를 포함한 모든 문자
|
||||
시퀀스와 일치합니다. 이를 통해 패턴이 여러 디렉토리 수준에서 일치할 수
|
||||
있습니다. `**`가 패턴 내에 직접 포함된 경우, 주변 리터럴 텍스트 사이의
|
||||
슬래시를 포함하여 0개 이상의 문자와 일치할 수 있습니다.
|
||||
|
||||
`**`의 가장 중요한 용도는 특수 형식인 `/**/`입니다. 이는 0개 이상의
|
||||
전체 디렉토리 수준과 일치하므로 정확한 경로 구조를 모르더라도
|
||||
디렉토리 트리의 모든 깊이에서 파일과 일치시킬 수 있습니다.
|
||||
예를 들어, `src/**/main.js` 패턴은 `src/main.js`(0개의 디렉토리 건너뜀),
|
||||
`src/ui/main.js`(1개의 디렉토리 건너뜀), `src/ui/components/main.js`
|
||||
(2개의 디렉토리 건너뜀)와 일치합니다.
|
||||
|
||||
대괄호 `[]`를 사용하는 문자 클래스는 지정된 세트 또는 범위에서
|
||||
단일 문자와 일치합니다. 다른 단일 문자 패턴과 마찬가지로 디렉토리
|
||||
구분 기호와는 일치하지 않습니다. 클래스는 범위 및 느낌표를 사용한
|
||||
부정을 지원합니다.
|
||||
|
||||
기억해야 할 근본적인 차이점은 `*`, `?` 및 문자 클래스는 모두
|
||||
디렉토리 경계를 준수하고 단일 경로 구성 요소 내에서만 일치하는 반면,
|
||||
`**`는 디렉토리 구분 기호를 가로질러 일치할 수 있는 유일한 패턴이라는 것입니다.
|
||||
|
||||
네 가지 유형의 패턴이 있습니다:
|
||||
|
||||
=FILE
|
||||
FILE이라는 이름의 모든 파일을 선택합니다. *, ?와 같은 글로빙
|
||||
문자와 [a-z]와 같은 문자 클래스를 사용할 수 있습니다.
|
||||
FILE이라는 이름의 모든 파일을 선택합니다.
|
||||
이 패턴은 디렉토리가 아닌 파일에만 적용됩니다.
|
||||
|
||||
=DIR/
|
||||
DIR이라는 이름의 모든 디렉토리와 그 안의 모든 것을 선택합니다.
|
||||
*, ?와 같은 글로빙 문자를 사용할 수 있습니다.
|
||||
이 패턴은 파일이 아닌 디렉토리에만 적용됩니다.
|
||||
|
||||
=/PATH/FILE
|
||||
정확히 지정된 파일 경로를 선택합니다. *, ?와 같은 글로빙
|
||||
문자를 사용할 수 있지만, 디렉토리 슬래시와는 절대 일치하지 않습니다.
|
||||
이 패턴은 디렉토리가 아닌 파일에만 적용됩니다.
|
||||
지정된 정확한 파일 경로를 선택합니다. 이 패턴은 디렉토리가 아닌
|
||||
파일에만 적용됩니다.
|
||||
|
||||
=/PATH/DIR/
|
||||
정확히 지정된 디렉토리 경로와 그 안의 모든 것을 선택합니다.
|
||||
*, ?와 같은 글로빙 문자를 사용할 수 있지만, 디렉토리 슬래시와는
|
||||
절대 일치하지 않습니다.
|
||||
지정된 정확한 디렉토리 경로와 그 안의 모든 것을 선택합니다.
|
||||
이 패턴은 파일이 아닌 디렉토리에만 적용됩니다.
|
||||
|
||||
/로 시작하는 절대 경로를 지정하면 로컬 파일 시스템의 루트 디렉토리가
|
||||
|
|
|
|||
|
|
@ -1375,30 +1375,56 @@ Windows의 일반적인 설정 예는 다음과 같습니다:
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
패턴은 처리에서 제외하거나 포함할 파일의 하위 집합을 선택하는 데
|
||||
사용됩니다.
|
||||
패턴은 포함하거나 제외할 파일을 필터링하는 유연한 방법을 제공합니다.
|
||||
글로빙(globbing) 문자를 사용하면 모든 경로를 일일이 나열하지 않고도
|
||||
특정 파일 이름이나 전체 디렉토리 구조와 일치하는 규칙을 정의할 수 있습니다.
|
||||
|
||||
물음표 `?`는 디렉토리 구분 기호를 제외한 모든 단일 문자와 일치합니다.
|
||||
이는 패턴을 단일 디렉토리 수준으로 제한하면서 가변 문자가 포함된
|
||||
파일 이름을 일치시키는 데 유용합니다.
|
||||
|
||||
단일 별표 `*`는 모든 문자 시퀀스와 일치하지만, 물음표와 마찬가지로
|
||||
디렉토리 경계를 넘지 않습니다. 슬래시에서 멈추므로 단일 경로 구성 요소
|
||||
내에서의 일치에 적합합니다. 이는 쉘 글로빙에서 익숙한 표준 와일드카드
|
||||
동작입니다.
|
||||
|
||||
이중 별표 `**`는 더 강력하며 디렉토리 구분 기호를 포함한 모든 문자
|
||||
시퀀스와 일치합니다. 이를 통해 패턴이 여러 디렉토리 수준에서 일치할 수
|
||||
있습니다. `**`가 패턴 내에 직접 포함된 경우, 주변 리터럴 텍스트 사이의
|
||||
슬래시를 포함하여 0개 이상의 문자와 일치할 수 있습니다.
|
||||
|
||||
`**`의 가장 중요한 용도는 특수 형식인 `/**/`입니다. 이는 0개 이상의
|
||||
전체 디렉토리 수준과 일치하므로 정확한 경로 구조를 모르더라도
|
||||
디렉토리 트리의 모든 깊이에서 파일과 일치시킬 수 있습니다.
|
||||
예를 들어, `src/**/main.js` 패턴은 `src/main.js`(0개의 디렉토리 건너뜀),
|
||||
`src/ui/main.js`(1개의 디렉토리 건너뜀), `src/ui/components/main.js`
|
||||
(2개의 디렉토리 건너뜀)와 일치합니다.
|
||||
|
||||
대괄호 `[]`를 사용하는 문자 클래스는 지정된 세트 또는 범위에서
|
||||
단일 문자와 일치합니다. 다른 단일 문자 패턴과 마찬가지로 디렉토리
|
||||
구분 기호와는 일치하지 않습니다. 클래스는 범위 및 느낌표를 사용한
|
||||
부정을 지원합니다.
|
||||
|
||||
기억해야 할 근본적인 차이점은 `*`, `?` 및 문자 클래스는 모두
|
||||
디렉토리 경계를 준수하고 단일 경로 구성 요소 내에서만 일치하는 반면,
|
||||
`**`는 디렉토리 구분 기호를 가로질러 일치할 수 있는 유일한 패턴이라는 것입니다.
|
||||
|
||||
네 가지 유형의 패턴이 있습니다:
|
||||
|
||||
FILE
|
||||
FILE이라는 이름의 모든 파일을 선택합니다. *, ?와 같은 글로빙
|
||||
문자와 [a-z]와 같은 문자 클래스를 사용할 수 있습니다.
|
||||
FILE이라는 이름의 모든 파일을 선택합니다.
|
||||
이 패턴은 디렉토리가 아닌 파일에만 적용됩니다.
|
||||
|
||||
DIR/
|
||||
DIR이라는 이름의 모든 디렉토리와 그 안의 모든 것을 선택합니다.
|
||||
*, ?와 같은 글로빙 문자를 사용할 수 있습니다.
|
||||
이 패턴은 파일이 아닌 디렉토리에만 적용됩니다.
|
||||
|
||||
/PATH/FILE
|
||||
정확히 지정된 파일 경로를 선택합니다. *, ?와 같은 글로빙
|
||||
문자를 사용할 수 있지만, 디렉토리 슬래시와는 절대 일치하지 않습니다.
|
||||
이 패턴은 디렉토리가 아닌 파일에만 적용됩니다.
|
||||
지정된 정확한 파일 경로를 선택합니다. 이 패턴은 디렉토리가 아닌
|
||||
파일에만 적용됩니다.
|
||||
|
||||
/PATH/DIR/
|
||||
정확히 지정된 디렉토리 경로와 그 안의 모든 것을 선택합니다.
|
||||
*, ?와 같은 글로빙 문자를 사용할 수 있지만, 디렉토리 슬래시와는
|
||||
절대 일치하지 않습니다.
|
||||
지정된 정확한 디렉토리 경로와 그 안의 모든 것을 선택합니다.
|
||||
이 패턴은 파일이 아닌 디렉토리에만 적용됩니다.
|
||||
|
||||
/로 시작하는 절대 경로를 지정하면 로컬 파일 시스템의 루트 디렉토리가
|
||||
|
|
|
|||
|
|
@ -1691,32 +1691,61 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
Wzorce są używane do wybierania podzbioru plików do wykluczenia lub włączenia
|
||||
do procesu.
|
||||
Wzorce zapewniają elastyczny sposób filtrowania plików do uwzględnienia lub
|
||||
wykluczenia. Używając znaków globbingowych, można zdefiniować reguły, które
|
||||
pasują do określonych nazw plików lub całych struktur katalogów bez
|
||||
ręcznego wymieniania każdej ścieżki.
|
||||
.PP
|
||||
Znak zapytania \`?\` dopasowuje dowolny pojedynczy znak z wyjątkiem
|
||||
separatora katalogów. Dzięki temu jest przydatny do dopasowywania nazw plików ze
|
||||
zmiennymi znakami, przy jednoczesnym ograniczeniu wzorca do jednego poziomu katalogu.
|
||||
.PP
|
||||
Pojedyncza gwiazdka \`*\` dopasowuje dowolną sekwencję znaków, ale podobnie jak
|
||||
znak zapytania, nigdy nie przekracza granic katalogów. Zatrzymuje się na
|
||||
ukośniku, co czyni ją odpowiednią do dopasowywania w obrębie jednego
|
||||
składnika ścieżki. Jest to standardowe zachowanie symboli wieloznacznych znane
|
||||
z globbingu powłoki (shell).
|
||||
.PP
|
||||
Podwójna gwiazdka \`**\` jest potężniejsza, dopasowuje dowolną sekwencję
|
||||
znaków, w tym separatory katalogów. Pozwala to wzorcom dopasowywać się
|
||||
na wielu poziomach katalogów. Gdy \`**\` pojawia się bezpośrednio wewnątrz
|
||||
wzorca, może dopasować zero lub więcej znaków, w tym ukośniki między
|
||||
otaczającym tekstem dosłownym.
|
||||
.PP
|
||||
Najważniejszym zastosowaniem \`**\` jest specjalna forma \`/**/\`. Dopasowuje ona
|
||||
zero lub więcej pełnych poziomów katalogów, umożliwiając dopasowanie plików
|
||||
na dowolnej głębokości w drzewie katalogów bez znajomości dokładnej struktury ścieżki.
|
||||
Na przykład wzorzec \`src/**/main.js\` pasuje do \`src/main.js\` (pomijając
|
||||
zero katalogów), \`src/ui/main.js\` (pomijając jeden katalog) oraz
|
||||
\`src/ui/components/main.js\` (pomijając dwa katalogi).
|
||||
.PP
|
||||
Klasy znaków używające nawiasów kwadratowych \`[]\` dopasowują pojedynczy znak z
|
||||
określonego zestawu lub zakresu. Podobnie jak inne wzorce pojedynczych znaków,
|
||||
nie pasują one do separatorów katalogów. Klasy obsługują zakresy i negację za pomocą
|
||||
wykrzyknika.
|
||||
.PP
|
||||
Podstawową różnicą, o której należy pamiętać, jest to, że \`*\`, \`?\` i klasy znaków
|
||||
wszystkie respektują granice katalogów i dopasowują się tylko w obrębie jednego
|
||||
składnika ścieżki, podczas gdy \`**\` jest jedynym wzorcem, który może dopasowywać się poprzez
|
||||
separatory katalogów.
|
||||
.PP
|
||||
Istnieją cztery różne typy wzorców:
|
||||
.TP
|
||||
.B FILE
|
||||
Wybiera dowolny plik o nazwie FILE. Możesz użyć dowolnych
|
||||
znaków globbing, takich jak * i ?, oraz klas znaków, takich jak [a\-z].
|
||||
Wybiera dowolny plik o nazwie FILE.
|
||||
Ten wzorzec dotyczy tylko plików, a nie katalogów.
|
||||
.TP
|
||||
.B DIR/
|
||||
Wybiera dowolny katalog o nazwie DIR i wszystko w środku.
|
||||
Możesz użyć dowolnych znaków globbing, takich jak * i ?.
|
||||
Wybiera dowolny katalog o nazwie DIR i wszystko, co się w nim znajduje.
|
||||
Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Wybiera dokładnie określoną ścieżkę pliku. Możesz użyć dowolnych
|
||||
znaków globbing, takich jak * i ?, ale nigdy nie pasują one do
|
||||
ukośnika katalogu.
|
||||
Ten wzorzec dotyczy tylko plików, a nie katalogów.
|
||||
Wybiera dokładnie określoną ścieżkę pliku. Ten wzorzec dotyczy
|
||||
tylko plików, a nie katalogów.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Wybiera dokładnie określoną ścieżkę katalogu i wszystko
|
||||
w środku. Możesz użyć dowolnych znaków globbing, takich jak * i ?, ale
|
||||
nigdy nie pasują one do ukośnika katalogu.
|
||||
Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
Wybiera dokładnie określoną ścieżkę katalogu i wszystko, co się w nim
|
||||
znajduje. Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
.PP
|
||||
Gdy określisz ścieżkę bezwzględną zaczynającą się od /, jest ona stosowana w
|
||||
katalogu głównym macierzy, a nie w katalogu głównym lokalnego systemu plików.
|
||||
|
|
|
|||
|
|
@ -1318,32 +1318,61 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
Wzorce są używane do wybierania podzbioru plików do wykluczenia lub włączenia
|
||||
do procesu.
|
||||
Wzorce zapewniają elastyczny sposób filtrowania plików do uwzględnienia lub
|
||||
wykluczenia. Używając znaków globbingowych, można zdefiniować reguły, które
|
||||
pasują do określonych nazw plików lub całych struktur katalogów bez
|
||||
ręcznego wymieniania każdej ścieżki.
|
||||
|
||||
Znak zapytania `?` dopasowuje dowolny pojedynczy znak z wyjątkiem
|
||||
separatora katalogów. Dzięki temu jest przydatny do dopasowywania nazw plików ze
|
||||
zmiennymi znakami, przy jednoczesnym ograniczeniu wzorca do jednego poziomu katalogu.
|
||||
|
||||
Pojedyncza gwiazdka `*` dopasowuje dowolną sekwencję znaków, ale podobnie jak
|
||||
znak zapytania, nigdy nie przekracza granic katalogów. Zatrzymuje się na
|
||||
ukośniku, co czyni ją odpowiednią do dopasowywania w obrębie jednego
|
||||
składnika ścieżki. Jest to standardowe zachowanie symboli wieloznacznych znane
|
||||
z globbingu powłoki (shell).
|
||||
|
||||
Podwójna gwiazdka `**` jest potężniejsza, dopasowuje dowolną sekwencję
|
||||
znaków, w tym separatory katalogów. Pozwala to wzorcom dopasowywać się
|
||||
na wielu poziomach katalogów. Gdy `**` pojawia się bezpośrednio wewnątrz
|
||||
wzorca, może dopasować zero lub więcej znaków, w tym ukośniki między
|
||||
otaczającym tekstem dosłownym.
|
||||
|
||||
Najważniejszym zastosowaniem `**` jest specjalna forma `/**/`. Dopasowuje ona
|
||||
zero lub więcej pełnych poziomów katalogów, umożliwiając dopasowanie plików
|
||||
na dowolnej głębokości w drzewie katalogów bez znajomości dokładnej struktury ścieżki.
|
||||
Na przykład wzorzec `src/**/main.js` pasuje do `src/main.js` (pomijając
|
||||
zero katalogów), `src/ui/main.js` (pomijając jeden katalog) oraz
|
||||
`src/ui/components/main.js` (pomijając dwa katalogi).
|
||||
|
||||
Klasy znaków używające nawiasów kwadratowych `[]` dopasowują pojedynczy znak z
|
||||
określonego zestawu lub zakresu. Podobnie jak inne wzorce pojedynczych znaków,
|
||||
nie pasują one do separatorów katalogów. Klasy obsługują zakresy i negację za pomocą
|
||||
wykrzyknika.
|
||||
|
||||
Podstawową różnicą, o której należy pamiętać, jest to, że `*`, `?` i klasy znaków
|
||||
wszystkie respektują granice katalogów i dopasowują się tylko w obrębie jednego
|
||||
składnika ścieżki, podczas gdy `**` jest jedynym wzorcem, który może dopasowywać się poprzez
|
||||
separatory katalogów.
|
||||
|
||||
Istnieją cztery różne typy wzorców:
|
||||
|
||||
=FILE
|
||||
Wybiera dowolny plik o nazwie FILE. Możesz użyć dowolnych
|
||||
znaków globbing, takich jak * i ?, oraz klas znaków, takich jak [a-z].
|
||||
Wybiera dowolny plik o nazwie FILE.
|
||||
Ten wzorzec dotyczy tylko plików, a nie katalogów.
|
||||
|
||||
=DIR/
|
||||
Wybiera dowolny katalog o nazwie DIR i wszystko w środku.
|
||||
Możesz użyć dowolnych znaków globbing, takich jak * i ?.
|
||||
Wybiera dowolny katalog o nazwie DIR i wszystko, co się w nim znajduje.
|
||||
Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
|
||||
=/PATH/FILE
|
||||
Wybiera dokładnie określoną ścieżkę pliku. Możesz użyć dowolnych
|
||||
znaków globbing, takich jak * i ?, ale nigdy nie pasują one do
|
||||
ukośnika katalogu.
|
||||
Ten wzorzec dotyczy tylko plików, a nie katalogów.
|
||||
Wybiera dokładnie określoną ścieżkę pliku. Ten wzorzec dotyczy
|
||||
tylko plików, a nie katalogów.
|
||||
|
||||
=/PATH/DIR/
|
||||
Wybiera dokładnie określoną ścieżkę katalogu i wszystko
|
||||
w środku. Możesz użyć dowolnych znaków globbing, takich jak * i ?, ale
|
||||
nigdy nie pasują one do ukośnika katalogu.
|
||||
Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
Wybiera dokładnie określoną ścieżkę katalogu i wszystko, co się w nim
|
||||
znajduje. Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
|
||||
Gdy określisz ścieżkę bezwzględną zaczynającą się od /, jest ona stosowana w
|
||||
katalogu głównym macierzy, a nie w katalogu głównym lokalnego systemu plików.
|
||||
|
|
|
|||
|
|
@ -1417,32 +1417,61 @@ Przykład typowej konfiguracji dla systemu Windows:
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
Wzorce są używane do wybierania podzbioru plików do wykluczenia lub włączenia
|
||||
do procesu.
|
||||
Wzorce zapewniają elastyczny sposób filtrowania plików do uwzględnienia lub
|
||||
wykluczenia. Używając znaków globbingowych, można zdefiniować reguły, które
|
||||
pasują do określonych nazw plików lub całych struktur katalogów bez
|
||||
ręcznego wymieniania każdej ścieżki.
|
||||
|
||||
Znak zapytania `?` dopasowuje dowolny pojedynczy znak z wyjątkiem
|
||||
separatora katalogów. Dzięki temu jest przydatny do dopasowywania nazw plików ze
|
||||
zmiennymi znakami, przy jednoczesnym ograniczeniu wzorca do jednego poziomu katalogu.
|
||||
|
||||
Pojedyncza gwiazdka `*` dopasowuje dowolną sekwencję znaków, ale podobnie jak
|
||||
znak zapytania, nigdy nie przekracza granic katalogów. Zatrzymuje się na
|
||||
ukośniku, co czyni ją odpowiednią do dopasowywania w obrębie jednego
|
||||
składnika ścieżki. Jest to standardowe zachowanie symboli wieloznacznych znane
|
||||
z globbingu powłoki (shell).
|
||||
|
||||
Podwójna gwiazdka `**` jest potężniejsza, dopasowuje dowolną sekwencję
|
||||
znaków, w tym separatory katalogów. Pozwala to wzorcom dopasowywać się
|
||||
na wielu poziomach katalogów. Gdy `**` pojawia się bezpośrednio wewnątrz
|
||||
wzorca, może dopasować zero lub więcej znaków, w tym ukośniki między
|
||||
otaczającym tekstem dosłownym.
|
||||
|
||||
Najważniejszym zastosowaniem `**` jest specjalna forma `/**/`. Dopasowuje ona
|
||||
zero lub więcej pełnych poziomów katalogów, umożliwiając dopasowanie plików
|
||||
na dowolnej głębokości w drzewie katalogów bez znajomości dokładnej struktury ścieżki.
|
||||
Na przykład wzorzec `src/**/main.js` pasuje do `src/main.js` (pomijając
|
||||
zero katalogów), `src/ui/main.js` (pomijając jeden katalog) oraz
|
||||
`src/ui/components/main.js` (pomijając dwa katalogi).
|
||||
|
||||
Klasy znaków używające nawiasów kwadratowych `[]` dopasowują pojedynczy znak z
|
||||
określonego zestawu lub zakresu. Podobnie jak inne wzorce pojedynczych znaków,
|
||||
nie pasują one do separatorów katalogów. Klasy obsługują zakresy i negację za pomocą
|
||||
wykrzyknika.
|
||||
|
||||
Podstawową różnicą, o której należy pamiętać, jest to, że `*`, `?` i klasy znaków
|
||||
wszystkie respektują granice katalogów i dopasowują się tylko w obrębie jednego
|
||||
składnika ścieżki, podczas gdy `**` jest jedynym wzorcem, który może dopasowywać się poprzez
|
||||
separatory katalogów.
|
||||
|
||||
Istnieją cztery różne typy wzorców:
|
||||
|
||||
FILE
|
||||
Wybiera dowolny plik o nazwie FILE. Możesz użyć dowolnych
|
||||
znaków globbing, takich jak * i ?, oraz klas znaków, takich jak [a-z].
|
||||
Wybiera dowolny plik o nazwie FILE.
|
||||
Ten wzorzec dotyczy tylko plików, a nie katalogów.
|
||||
|
||||
DIR/
|
||||
Wybiera dowolny katalog o nazwie DIR i wszystko w środku.
|
||||
Możesz użyć dowolnych znaków globbing, takich jak * i ?.
|
||||
Wybiera dowolny katalog o nazwie DIR i wszystko, co się w nim znajduje.
|
||||
Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
|
||||
/PATH/FILE
|
||||
Wybiera dokładnie określoną ścieżkę pliku. Możesz użyć dowolnych
|
||||
znaków globbing, takich jak * i ?, ale nigdy nie pasują one do
|
||||
ukośnika katalogu.
|
||||
Ten wzorzec dotyczy tylko plików, a nie katalogów.
|
||||
Wybiera dokładnie określoną ścieżkę pliku. Ten wzorzec dotyczy
|
||||
tylko plików, a nie katalogów.
|
||||
|
||||
/PATH/DIR/
|
||||
Wybiera dokładnie określoną ścieżkę katalogu i wszystko
|
||||
w środku. Możesz użyć dowolnych znaków globbing, takich jak * i ?, ale
|
||||
nigdy nie pasują one do ukośnika katalogu.
|
||||
Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
Wybiera dokładnie określoną ścieżkę katalogu i wszystko, co się w nim
|
||||
znajduje. Ten wzorzec dotyczy tylko katalogów, a nie plików.
|
||||
|
||||
Gdy określisz ścieżkę bezwzględną zaczynającą się od /, jest ona stosowana w
|
||||
katalogu głównym macierzy, a nie w katalogu głównym lokalnego systemu plików.
|
||||
|
|
|
|||
|
|
@ -1730,32 +1730,61 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PADRãO (PATTERN)
|
||||
Padrões são usados para selecionar um subconjunto de arquivos a serem
|
||||
excluídos ou incluídos no processo.
|
||||
Os padrões fornecem uma maneira flexível de filtrar arquivos para inclusão ou
|
||||
exclusão. Ao usar caracteres de globbing, você pode definir regras que
|
||||
correspondam a nomes de arquivos específicos ou estruturas de diretórios inteiras sem
|
||||
listar cada caminho manualmente.
|
||||
.PP
|
||||
O ponto de interrogação \`?\` corresponde a qualquer caractere único, exceto o
|
||||
separador de diretórios. Isso o torna útil para corresponder nomes de arquivos com
|
||||
caracteres variáveis, mantendo o padrão confinado a um único nível de diretório.
|
||||
.PP
|
||||
O asterisco simples \`*\` corresponde a qualquer sequência de caracteres, mas, como o
|
||||
ponto de interrogação, nunca cruza as fronteiras do diretório. Ele para na
|
||||
barra invertida, tornando\-o adequado para correspondência dentro de um único
|
||||
componente de caminho. Este é o comportamento padrão de curinga familiar do
|
||||
globbing de shell.
|
||||
.PP
|
||||
O asterisco duplo \`**\` é mais poderoso, ele corresponde a qualquer sequência de
|
||||
caracteres, incluindo separadores de diretórios. Isso permite que os padrões correspondam
|
||||
em vários níveis de diretório. Quando o \`**\` aparece incorporado diretamente em
|
||||
um padrão, ele pode corresponder a zero ou mais caracteres, incluindo barras entre
|
||||
o texto literal circundante.
|
||||
.PP
|
||||
O uso mais importante do \`**\` é na forma especial \`/**/\`. Isso corresponde a
|
||||
zero ou mais níveis de diretório completos, tornando possível corresponder arquivos
|
||||
em qualquer profundidade em uma árvore de diretórios sem conhecer a estrutura exata do caminho.
|
||||
Por exemplo, o padrão \`src/**/main.js\` corresponde a \`src/main.js\` (pulando
|
||||
zero diretórios), \`src/ui/main.js\` (pulando um diretório) e
|
||||
\`src/ui/components/main.js\` (pulando dois diretórios).
|
||||
.PP
|
||||
Classes de caracteres usando colchetes \`[]\` correspondem a um único caractere de um
|
||||
conjunto ou intervalo especificado. Como os outros padrões de caractere único, elas
|
||||
não correspondem a separadores de diretório. As classes suportam intervalos e negação usando
|
||||
um ponto de exclamação.
|
||||
.PP
|
||||
A distinção fundamental a ser lembrada é que \`*\`, \`?\` e classes de caracteres
|
||||
respeitam os limites do diretório e correspondem apenas dentro de um único
|
||||
componente de caminho, enquanto \`**\` é o único padrão que pode corresponder através de
|
||||
separadores de diretório.
|
||||
.PP
|
||||
Existem quatro tipos diferentes de padrões:
|
||||
.TP
|
||||
.B FILE
|
||||
Seleciona qualquer arquivo chamado FILE. Você pode usar quaisquer
|
||||
caracteres globbing como * e ?, e classes de caracteres como [a\-z].
|
||||
Seleciona qualquer arquivo chamado FILE.
|
||||
Este padrão se aplica apenas a arquivos, não a diretórios.
|
||||
.TP
|
||||
.B DIR/
|
||||
Seleciona qualquer diretório chamado DIR e tudo dentro.
|
||||
Você pode usar quaisquer caracteres globbing como * e ?.
|
||||
Seleciona qualquer diretório chamado DIR e tudo o que estiver dentro dele.
|
||||
Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Seleciona o caminho exato do arquivo especificado. Você pode usar
|
||||
quaisquer caracteres globbing como * e ?, mas eles nunca correspondem
|
||||
a uma barra de diretório.
|
||||
Este padrão se aplica apenas a arquivos, não a diretórios.
|
||||
Seleciona o caminho exato do arquivo especificado. Este padrão se aplica
|
||||
apenas a arquivos, não a diretórios.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Seleciona o caminho exato do diretório especificado e tudo
|
||||
dentro. Você pode usar quaisquer caracteres globbing como * e ?, mas
|
||||
eles nunca correspondem a uma barra de diretório.
|
||||
Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
Seleciona o caminho exato do diretório especificado e tudo o que estiver
|
||||
dentro dele. Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
.PP
|
||||
Quando você especifica um caminho absoluto começando com /, ele é aplicado
|
||||
no diretório raiz do array, não no diretório raiz do sistema de arquivos local.
|
||||
|
|
|
|||
|
|
@ -1357,32 +1357,61 @@ Configuração
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Padrão (Pattern)
|
||||
Padrões são usados para selecionar um subconjunto de arquivos a serem
|
||||
excluídos ou incluídos no processo.
|
||||
Os padrões fornecem uma maneira flexível de filtrar arquivos para inclusão ou
|
||||
exclusão. Ao usar caracteres de globbing, você pode definir regras que
|
||||
correspondam a nomes de arquivos específicos ou estruturas de diretórios inteiras sem
|
||||
listar cada caminho manualmente.
|
||||
|
||||
O ponto de interrogação `?` corresponde a qualquer caractere único, exceto o
|
||||
separador de diretórios. Isso o torna útil para corresponder nomes de arquivos com
|
||||
caracteres variáveis, mantendo o padrão confinado a um único nível de diretório.
|
||||
|
||||
O asterisco simples `*` corresponde a qualquer sequência de caracteres, mas, como o
|
||||
ponto de interrogação, nunca cruza as fronteiras do diretório. Ele para na
|
||||
barra invertida, tornando-o adequado para correspondência dentro de um único
|
||||
componente de caminho. Este é o comportamento padrão de curinga familiar do
|
||||
globbing de shell.
|
||||
|
||||
O asterisco duplo `**` é mais poderoso, ele corresponde a qualquer sequência de
|
||||
caracteres, incluindo separadores de diretórios. Isso permite que os padrões correspondam
|
||||
em vários níveis de diretório. Quando o `**` aparece incorporado diretamente em
|
||||
um padrão, ele pode corresponder a zero ou mais caracteres, incluindo barras entre
|
||||
o texto literal circundante.
|
||||
|
||||
O uso mais importante do `**` é na forma especial `/**/`. Isso corresponde a
|
||||
zero ou mais níveis de diretório completos, tornando possível corresponder arquivos
|
||||
em qualquer profundidade em uma árvore de diretórios sem conhecer a estrutura exata do caminho.
|
||||
Por exemplo, o padrão `src/**/main.js` corresponde a `src/main.js` (pulando
|
||||
zero diretórios), `src/ui/main.js` (pulando um diretório) e
|
||||
`src/ui/components/main.js` (pulando dois diretórios).
|
||||
|
||||
Classes de caracteres usando colchetes `[]` correspondem a um único caractere de um
|
||||
conjunto ou intervalo especificado. Como os outros padrões de caractere único, elas
|
||||
não correspondem a separadores de diretório. As classes suportam intervalos e negação usando
|
||||
um ponto de exclamação.
|
||||
|
||||
A distinção fundamental a ser lembrada é que `*`, `?` e classes de caracteres
|
||||
respeitam os limites do diretório e correspondem apenas dentro de um único
|
||||
componente de caminho, enquanto `**` é o único padrão que pode corresponder através de
|
||||
separadores de diretório.
|
||||
|
||||
Existem quatro tipos diferentes de padrões:
|
||||
|
||||
=FILE
|
||||
Seleciona qualquer arquivo chamado FILE. Você pode usar quaisquer
|
||||
caracteres globbing como * e ?, e classes de caracteres como [a-z].
|
||||
Seleciona qualquer arquivo chamado FILE.
|
||||
Este padrão se aplica apenas a arquivos, não a diretórios.
|
||||
|
||||
=DIR/
|
||||
Seleciona qualquer diretório chamado DIR e tudo dentro.
|
||||
Você pode usar quaisquer caracteres globbing como * e ?.
|
||||
Seleciona qualquer diretório chamado DIR e tudo o que estiver dentro dele.
|
||||
Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
|
||||
=/PATH/FILE
|
||||
Seleciona o caminho exato do arquivo especificado. Você pode usar
|
||||
quaisquer caracteres globbing como * e ?, mas eles nunca correspondem
|
||||
a uma barra de diretório.
|
||||
Este padrão se aplica apenas a arquivos, não a diretórios.
|
||||
Seleciona o caminho exato do arquivo especificado. Este padrão se aplica
|
||||
apenas a arquivos, não a diretórios.
|
||||
|
||||
=/PATH/DIR/
|
||||
Seleciona o caminho exato do diretório especificado e tudo
|
||||
dentro. Você pode usar quaisquer caracteres globbing como * e ?, mas
|
||||
eles nunca correspondem a uma barra de diretório.
|
||||
Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
Seleciona o caminho exato do diretório especificado e tudo o que estiver
|
||||
dentro dele. Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
|
||||
Quando você especifica um caminho absoluto começando com /, ele é aplicado
|
||||
no diretório raiz do array, não no diretório raiz do sistema de arquivos local.
|
||||
|
|
|
|||
|
|
@ -1456,32 +1456,61 @@ Um exemplo de uma configuração típica para Windows é:
|
|||
8 PADRãO (PATTERN)
|
||||
==================
|
||||
|
||||
Padrões são usados para selecionar um subconjunto de arquivos a serem
|
||||
excluídos ou incluídos no processo.
|
||||
Os padrões fornecem uma maneira flexível de filtrar arquivos para inclusão ou
|
||||
exclusão. Ao usar caracteres de globbing, você pode definir regras que
|
||||
correspondam a nomes de arquivos específicos ou estruturas de diretórios inteiras sem
|
||||
listar cada caminho manualmente.
|
||||
|
||||
O ponto de interrogação `?` corresponde a qualquer caractere único, exceto o
|
||||
separador de diretórios. Isso o torna útil para corresponder nomes de arquivos com
|
||||
caracteres variáveis, mantendo o padrão confinado a um único nível de diretório.
|
||||
|
||||
O asterisco simples `*` corresponde a qualquer sequência de caracteres, mas, como o
|
||||
ponto de interrogação, nunca cruza as fronteiras do diretório. Ele para na
|
||||
barra invertida, tornando-o adequado para correspondência dentro de um único
|
||||
componente de caminho. Este é o comportamento padrão de curinga familiar do
|
||||
globbing de shell.
|
||||
|
||||
O asterisco duplo `**` é mais poderoso, ele corresponde a qualquer sequência de
|
||||
caracteres, incluindo separadores de diretórios. Isso permite que os padrões correspondam
|
||||
em vários níveis de diretório. Quando o `**` aparece incorporado diretamente em
|
||||
um padrão, ele pode corresponder a zero ou mais caracteres, incluindo barras entre
|
||||
o texto literal circundante.
|
||||
|
||||
O uso mais importante do `**` é na forma especial `/**/`. Isso corresponde a
|
||||
zero ou mais níveis de diretório completos, tornando possível corresponder arquivos
|
||||
em qualquer profundidade em uma árvore de diretórios sem conhecer a estrutura exata do caminho.
|
||||
Por exemplo, o padrão `src/**/main.js` corresponde a `src/main.js` (pulando
|
||||
zero diretórios), `src/ui/main.js` (pulando um diretório) e
|
||||
`src/ui/components/main.js` (pulando dois diretórios).
|
||||
|
||||
Classes de caracteres usando colchetes `[]` correspondem a um único caractere de um
|
||||
conjunto ou intervalo especificado. Como os outros padrões de caractere único, elas
|
||||
não correspondem a separadores de diretório. As classes suportam intervalos e negação usando
|
||||
um ponto de exclamação.
|
||||
|
||||
A distinção fundamental a ser lembrada é que `*`, `?` e classes de caracteres
|
||||
respeitam os limites do diretório e correspondem apenas dentro de um único
|
||||
componente de caminho, enquanto `**` é o único padrão que pode corresponder através de
|
||||
separadores de diretório.
|
||||
|
||||
Existem quatro tipos diferentes de padrões:
|
||||
|
||||
FILE
|
||||
Seleciona qualquer arquivo chamado FILE. Você pode usar quaisquer
|
||||
caracteres globbing como * e ?, e classes de caracteres como [a-z].
|
||||
Seleciona qualquer arquivo chamado FILE.
|
||||
Este padrão se aplica apenas a arquivos, não a diretórios.
|
||||
|
||||
DIR/
|
||||
Seleciona qualquer diretório chamado DIR e tudo dentro.
|
||||
Você pode usar quaisquer caracteres globbing como * e ?.
|
||||
Seleciona qualquer diretório chamado DIR e tudo o que estiver dentro dele.
|
||||
Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
|
||||
/PATH/FILE
|
||||
Seleciona o caminho exato do arquivo especificado. Você pode usar
|
||||
quaisquer caracteres globbing como * e ?, mas eles nunca correspondem
|
||||
a uma barra de diretório.
|
||||
Este padrão se aplica apenas a arquivos, não a diretórios.
|
||||
Seleciona o caminho exato do arquivo especificado. Este padrão se aplica
|
||||
apenas a arquivos, não a diretórios.
|
||||
|
||||
/PATH/DIR/
|
||||
Seleciona o caminho exato do diretório especificado e tudo
|
||||
dentro. Você pode usar quaisquer caracteres globbing como * e ?, mas
|
||||
eles nunca correspondem a uma barra de diretório.
|
||||
Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
Seleciona o caminho exato do diretório especificado e tudo o que estiver
|
||||
dentro dele. Este padrão se aplica apenas a diretórios, não a arquivos.
|
||||
|
||||
Quando você especifica um caminho absoluto começando com /, ele é aplicado
|
||||
no diretório raiz do array, não no diretório raiz do sistema de arquivos local.
|
||||
|
|
|
|||
|
|
@ -1693,32 +1693,61 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH MODEL (PATTERN)
|
||||
Modelele sunt utilizate pentru a selecta un subset de fișiere de exclus sau inclus în
|
||||
proces.
|
||||
Modelele oferă o modalitate flexibilă de a filtra fișierele pentru includere sau
|
||||
excludere. Folosind caractere de tip globbing, puteți defini reguli care să
|
||||
se potrivească cu nume de fișiere specifice sau cu structuri întregi de directoare fără
|
||||
a lista manual fiecare cale.
|
||||
.PP
|
||||
Semnul întrebării \`?\` se potrivește cu orice caracter unic, cu excepția
|
||||
separatorului de directoare. Acest lucru îl face util pentru potrivirea numelor de fișiere cu
|
||||
caractere variabile, păstrând în același timp modelul limitat la un singur nivel de director.
|
||||
.PP
|
||||
Asteriscul simplu \`*\` se potrivește cu orice secvență de caractere, dar, la fel ca
|
||||
semnul întrebării, nu trece niciodată de limitele directoarelor. Se oprește la
|
||||
slash\-ul înainte, ceea ce îl face potrivit pentru potrivirea în cadrul unei singure
|
||||
componente a căii. Acesta este comportamentul standard al metacaracterelor, familiar
|
||||
din shell globbing.
|
||||
.PP
|
||||
Asteriscul dublu \`**\` este mai puternic, se potrivește cu orice secvență de
|
||||
caractere, inclusiv separatori de directoare. Acest lucru permite modelelor să se potrivească
|
||||
pe mai multe niveluri de directoare. Când \`**\` apare inserat direct într\-un
|
||||
model, se poate potrivi cu zero sau mai multe caractere, inclusiv slash\-uri între
|
||||
textul literal înconjurător.
|
||||
.PP
|
||||
Cea mai importantă utilizare a lui \`**\` este în forma specială \`/**/\`. Aceasta se potrivește cu
|
||||
zero sau mai multe niveluri complete de directoare, făcând posibilă potrivirea fișierelor
|
||||
la orice adâncime într\-un arbore de directoare fără a cunoaște structura exactă a căii.
|
||||
De exemplu, modelul \`src/**/main.js\` se potrivește cu \`src/main.js\` (sărind
|
||||
peste zero directoare), \`src/ui/main.js\` (sărind peste un director) și
|
||||
\`src/ui/components/main.js\` (sărind peste două directoare).
|
||||
.PP
|
||||
Clasele de caractere care utilizează paranteze pătrate \`[]\` se potrivesc cu un singur caracter dintr\-un
|
||||
set sau interval specificat. La fel ca și celelalte modele de un singur caracter, acestea
|
||||
nu se potrivesc cu separatorii de directoare. Clasele suportă intervale și negarea folosind
|
||||
un semn de exclamare.
|
||||
.PP
|
||||
Distincția fundamentală de reținut este că \`*\`, \`?\` și clasele de caractere
|
||||
respectă toate limitele directoarelor și se potrivesc doar în cadrul unei singure
|
||||
componente a căii, în timp ce \`**\` este singurul model care se poate potrivi peste
|
||||
separatorii de directoare.
|
||||
.PP
|
||||
Există patru tipuri diferite de modele:
|
||||
.TP
|
||||
.B FILE
|
||||
Selectează orice fișier numit FILE. Puteți utiliza orice caracter de globbing
|
||||
precum * și ?, și clase de caractere precum [a\-z].
|
||||
Acest model se aplică numai fișierelor, nu directoarelor.
|
||||
Selectează orice fișier cu numele FILE.
|
||||
Acest model se aplică numai fișierelor, nu și directoarelor.
|
||||
.TP
|
||||
.B DIR/
|
||||
Selectează orice director numit DIR și tot ce se află în interior.
|
||||
Puteți utiliza orice caracter de globbing precum * și ?.
|
||||
Acest model se aplică numai directoarelor, nu fișierelor.
|
||||
Selectează orice director cu numele DIR și tot ce se află în interior.
|
||||
Acest model se aplică numai directoarelor, nu și fișierelor.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Selectează calea exactă a fișierului specificat. Puteți utiliza orice
|
||||
caractere de globbing precum * și ?, dar acestea nu se potrivesc niciodată cu o
|
||||
bară oblică de director (directory slash).
|
||||
Acest model se aplică numai fișierelor, nu directoarelor.
|
||||
Selectează calea exactă a fișierului specificat. Acest model se aplică
|
||||
numai fișierelor, nu și directoarelor.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Selectează calea exactă a directorului specificat și tot ce se află
|
||||
în interior. Puteți utiliza orice caractere de globbing precum * și ?, dar
|
||||
acestea nu se potrivesc niciodată cu o bară oblică de director.
|
||||
Acest model se aplică numai directoarelor, nu fișierelor.
|
||||
în interior. Acest model se aplică numai directoarelor, nu și fișierelor.
|
||||
.PP
|
||||
Când specificați o cale absolută care începe cu /, aceasta este aplicată la
|
||||
directorul rădăcină al matricei, nu la directorul rădăcină al sistemului de fișiere local.
|
||||
|
|
|
|||
|
|
@ -1320,32 +1320,61 @@ Configurare
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Model (Pattern)
|
||||
Modelele sunt utilizate pentru a selecta un subset de fișiere de exclus sau inclus în
|
||||
proces.
|
||||
Modelele oferă o modalitate flexibilă de a filtra fișierele pentru includere sau
|
||||
excludere. Folosind caractere de tip globbing, puteți defini reguli care să
|
||||
se potrivească cu nume de fișiere specifice sau cu structuri întregi de directoare fără
|
||||
a lista manual fiecare cale.
|
||||
|
||||
Semnul întrebării `?` se potrivește cu orice caracter unic, cu excepția
|
||||
separatorului de directoare. Acest lucru îl face util pentru potrivirea numelor de fișiere cu
|
||||
caractere variabile, păstrând în același timp modelul limitat la un singur nivel de director.
|
||||
|
||||
Asteriscul simplu `*` se potrivește cu orice secvență de caractere, dar, la fel ca
|
||||
semnul întrebării, nu trece niciodată de limitele directoarelor. Se oprește la
|
||||
slash-ul înainte, ceea ce îl face potrivit pentru potrivirea în cadrul unei singure
|
||||
componente a căii. Acesta este comportamentul standard al metacaracterelor, familiar
|
||||
din shell globbing.
|
||||
|
||||
Asteriscul dublu `**` este mai puternic, se potrivește cu orice secvență de
|
||||
caractere, inclusiv separatori de directoare. Acest lucru permite modelelor să se potrivească
|
||||
pe mai multe niveluri de directoare. Când `**` apare inserat direct într-un
|
||||
model, se poate potrivi cu zero sau mai multe caractere, inclusiv slash-uri între
|
||||
textul literal înconjurător.
|
||||
|
||||
Cea mai importantă utilizare a lui `**` este în forma specială `/**/`. Aceasta se potrivește cu
|
||||
zero sau mai multe niveluri complete de directoare, făcând posibilă potrivirea fișierelor
|
||||
la orice adâncime într-un arbore de directoare fără a cunoaște structura exactă a căii.
|
||||
De exemplu, modelul `src/**/main.js` se potrivește cu `src/main.js` (sărind
|
||||
peste zero directoare), `src/ui/main.js` (sărind peste un director) și
|
||||
`src/ui/components/main.js` (sărind peste două directoare).
|
||||
|
||||
Clasele de caractere care utilizează paranteze pătrate `[]` se potrivesc cu un singur caracter dintr-un
|
||||
set sau interval specificat. La fel ca și celelalte modele de un singur caracter, acestea
|
||||
nu se potrivesc cu separatorii de directoare. Clasele suportă intervale și negarea folosind
|
||||
un semn de exclamare.
|
||||
|
||||
Distincția fundamentală de reținut este că `*`, `?` și clasele de caractere
|
||||
respectă toate limitele directoarelor și se potrivesc doar în cadrul unei singure
|
||||
componente a căii, în timp ce `**` este singurul model care se poate potrivi peste
|
||||
separatorii de directoare.
|
||||
|
||||
Există patru tipuri diferite de modele:
|
||||
|
||||
=FILE
|
||||
Selectează orice fișier numit FILE. Puteți utiliza orice caracter de globbing
|
||||
precum * și ?, și clase de caractere precum [a-z].
|
||||
Acest model se aplică numai fișierelor, nu directoarelor.
|
||||
Selectează orice fișier cu numele FILE.
|
||||
Acest model se aplică numai fișierelor, nu și directoarelor.
|
||||
|
||||
=DIR/
|
||||
Selectează orice director numit DIR și tot ce se află în interior.
|
||||
Puteți utiliza orice caracter de globbing precum * și ?.
|
||||
Acest model se aplică numai directoarelor, nu fișierelor.
|
||||
Selectează orice director cu numele DIR și tot ce se află în interior.
|
||||
Acest model se aplică numai directoarelor, nu și fișierelor.
|
||||
|
||||
=/PATH/FILE
|
||||
Selectează calea exactă a fișierului specificat. Puteți utiliza orice
|
||||
caractere de globbing precum * și ?, dar acestea nu se potrivesc niciodată cu o
|
||||
bară oblică de director (directory slash).
|
||||
Acest model se aplică numai fișierelor, nu directoarelor.
|
||||
Selectează calea exactă a fișierului specificat. Acest model se aplică
|
||||
numai fișierelor, nu și directoarelor.
|
||||
|
||||
=/PATH/DIR/
|
||||
Selectează calea exactă a directorului specificat și tot ce se află
|
||||
în interior. Puteți utiliza orice caractere de globbing precum * și ?, dar
|
||||
acestea nu se potrivesc niciodată cu o bară oblică de director.
|
||||
Acest model se aplică numai directoarelor, nu fișierelor.
|
||||
în interior. Acest model se aplică numai directoarelor, nu și fișierelor.
|
||||
|
||||
Când specificați o cale absolută care începe cu /, aceasta este aplicată la
|
||||
directorul rădăcină al matricei, nu la directorul rădăcină al sistemului de fișiere local.
|
||||
|
|
|
|||
|
|
@ -1419,32 +1419,61 @@ Un exemplu de configurare tipică pentru Windows este:
|
|||
8 MODEL (PATTERN)
|
||||
=================
|
||||
|
||||
Modelele sunt utilizate pentru a selecta un subset de fișiere de exclus sau inclus în
|
||||
proces.
|
||||
Modelele oferă o modalitate flexibilă de a filtra fișierele pentru includere sau
|
||||
excludere. Folosind caractere de tip globbing, puteți defini reguli care să
|
||||
se potrivească cu nume de fișiere specifice sau cu structuri întregi de directoare fără
|
||||
a lista manual fiecare cale.
|
||||
|
||||
Semnul întrebării `?` se potrivește cu orice caracter unic, cu excepția
|
||||
separatorului de directoare. Acest lucru îl face util pentru potrivirea numelor de fișiere cu
|
||||
caractere variabile, păstrând în același timp modelul limitat la un singur nivel de director.
|
||||
|
||||
Asteriscul simplu `*` se potrivește cu orice secvență de caractere, dar, la fel ca
|
||||
semnul întrebării, nu trece niciodată de limitele directoarelor. Se oprește la
|
||||
slash-ul înainte, ceea ce îl face potrivit pentru potrivirea în cadrul unei singure
|
||||
componente a căii. Acesta este comportamentul standard al metacaracterelor, familiar
|
||||
din shell globbing.
|
||||
|
||||
Asteriscul dublu `**` este mai puternic, se potrivește cu orice secvență de
|
||||
caractere, inclusiv separatori de directoare. Acest lucru permite modelelor să se potrivească
|
||||
pe mai multe niveluri de directoare. Când `**` apare inserat direct într-un
|
||||
model, se poate potrivi cu zero sau mai multe caractere, inclusiv slash-uri între
|
||||
textul literal înconjurător.
|
||||
|
||||
Cea mai importantă utilizare a lui `**` este în forma specială `/**/`. Aceasta se potrivește cu
|
||||
zero sau mai multe niveluri complete de directoare, făcând posibilă potrivirea fișierelor
|
||||
la orice adâncime într-un arbore de directoare fără a cunoaște structura exactă a căii.
|
||||
De exemplu, modelul `src/**/main.js` se potrivește cu `src/main.js` (sărind
|
||||
peste zero directoare), `src/ui/main.js` (sărind peste un director) și
|
||||
`src/ui/components/main.js` (sărind peste două directoare).
|
||||
|
||||
Clasele de caractere care utilizează paranteze pătrate `[]` se potrivesc cu un singur caracter dintr-un
|
||||
set sau interval specificat. La fel ca și celelalte modele de un singur caracter, acestea
|
||||
nu se potrivesc cu separatorii de directoare. Clasele suportă intervale și negarea folosind
|
||||
un semn de exclamare.
|
||||
|
||||
Distincția fundamentală de reținut este că `*`, `?` și clasele de caractere
|
||||
respectă toate limitele directoarelor și se potrivesc doar în cadrul unei singure
|
||||
componente a căii, în timp ce `**` este singurul model care se poate potrivi peste
|
||||
separatorii de directoare.
|
||||
|
||||
Există patru tipuri diferite de modele:
|
||||
|
||||
FILE
|
||||
Selectează orice fișier numit FILE. Puteți utiliza orice caracter de globbing
|
||||
precum * și ?, și clase de caractere precum [a-z].
|
||||
Acest model se aplică numai fișierelor, nu directoarelor.
|
||||
Selectează orice fișier cu numele FILE.
|
||||
Acest model se aplică numai fișierelor, nu și directoarelor.
|
||||
|
||||
DIR/
|
||||
Selectează orice director numit DIR și tot ce se află în interior.
|
||||
Puteți utiliza orice caracter de globbing precum * și ?.
|
||||
Acest model se aplică numai directoarelor, nu fișierelor.
|
||||
Selectează orice director cu numele DIR și tot ce se află în interior.
|
||||
Acest model se aplică numai directoarelor, nu și fișierelor.
|
||||
|
||||
/PATH/FILE
|
||||
Selectează calea exactă a fișierului specificat. Puteți utiliza orice
|
||||
caractere de globbing precum * și ?, dar acestea nu se potrivesc niciodată cu o
|
||||
bară oblică de director (directory slash).
|
||||
Acest model se aplică numai fișierelor, nu directoarelor.
|
||||
Selectează calea exactă a fișierului specificat. Acest model se aplică
|
||||
numai fișierelor, nu și directoarelor.
|
||||
|
||||
/PATH/DIR/
|
||||
Selectează calea exactă a directorului specificat și tot ce se află
|
||||
în interior. Puteți utiliza orice caractere de globbing precum * și ?, dar
|
||||
acestea nu se potrivesc niciodată cu o bară oblică de director.
|
||||
Acest model se aplică numai directoarelor, nu fișierelor.
|
||||
în interior. Acest model se aplică numai directoarelor, nu și fișierelor.
|
||||
|
||||
Când specificați o cale absolută care începe cu /, aceasta este aplicată la
|
||||
directorul rădăcină al matricei, nu la directorul rădăcină al sistemului de fișiere local.
|
||||
|
|
|
|||
|
|
@ -1697,32 +1697,61 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
Шаблоны используются для выбора подмножества файлов для исключения или включения
|
||||
в процесс.
|
||||
Шаблоны обеспечивают гибкий способ фильтрации файлов для включения или
|
||||
исключения. Используя символы подстановки (globbing), вы можете определить правила,
|
||||
которые соответствуют конкретным именам файлов или целым структурам каталогов без
|
||||
ручного перечисления каждого пути.
|
||||
.PP
|
||||
Вопросительный знак \`?\` соответствует любому одиночному символу, кроме
|
||||
разделителя каталогов. Это делает его полезным для сопоставления имен файлов с
|
||||
переменными символами, при этом шаблон ограничивается одним уровнем каталога.
|
||||
.PP
|
||||
Одиночная звездочка \`*\` соответствует любой последовательности символов, но, как и
|
||||
вопросительный знак, она никогда не пересекает границы каталогов. Она останавливается на
|
||||
прямой косой черте, что делает ее подходящей для сопоставления внутри одного
|
||||
компонента пути. Это стандартное поведение подстановочных знаков, знакомое
|
||||
по оболочке (shell).
|
||||
.PP
|
||||
Двойная звездочка \`**\` более мощная, она соответствует любой последовательности
|
||||
символов, включая разделители каталогов. Это позволяет шаблонам соответствовать
|
||||
нескольким уровням каталогов. Когда \`**\` появляется непосредственно в
|
||||
шаблоне, она может соответствовать нулю или более символам, включая косые черты между
|
||||
окружающим буквальным текстом.
|
||||
.PP
|
||||
Наиболее важным использованием \`**\` является специальная форма \`/**/\`. Она соответствует
|
||||
нулю или более полным уровням каталогов, что позволяет сопоставлять файлы
|
||||
на любой глубине в дереве каталогов, не зная точной структуры пути.
|
||||
Например, шаблон \`src/**/main.js\` соответствует \`src/main.js\` (пропуск
|
||||
ноля каталогов), \`src/ui/main.js\` (пропуск одного каталога) и
|
||||
\`src/ui/components/main.js\` (пропуск двух каталогов).
|
||||
.PP
|
||||
Классы символов с использованием квадратных скобок \`[]\` соответствуют одному символу из
|
||||
заданного набора или диапазона. Как и другие односимвольные шаблоны, они
|
||||
не соответствуют разделителям каталогов. Классы поддерживают диапазоны и отрицание с
|
||||
использованием восклицательного знака.
|
||||
.PP
|
||||
Фундаментальное различие, которое следует помнить, заключается в том, что \`*\`, \`?\` и классы
|
||||
символов соблюдают границы каталогов и соответствуют только внутри одного
|
||||
компонента пути, в то время как \`**\` — единственный шаблон, который может соответствовать
|
||||
через разделители каталогов.
|
||||
.PP
|
||||
Существует четыре различных типа шаблонов:
|
||||
.TP
|
||||
.B FILE
|
||||
Выбирает любой файл с именем FILE. Вы можете использовать любые символы
|
||||
глоббинга, такие как * и ?, и классы символов, такие как [a\-z].
|
||||
Этот шаблон применяется только к файлам, а не к каталогам.
|
||||
Выбирает любой файл с именем FILE.
|
||||
Этот шаблон применяется только к файлам, но не к директориям.
|
||||
.TP
|
||||
.B DIR/
|
||||
Выбирает любой каталог с именем DIR и все внутри.
|
||||
Вы можете использовать любые символы глоббинга, такие как * и ?.
|
||||
Этот шаблон применяется только к каталогам, а не к файлам.
|
||||
Выбирает любую директорию с именем DIR и все, что находится внутри нее.
|
||||
Этот шаблон применяется только к директориям, но не к файлам.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Выбирает точно указанный путь к файлу. Вы можете использовать любые
|
||||
символы глоббинга, такие как * и ?, но они никогда не совпадают с
|
||||
косой чертой каталога.
|
||||
Этот шаблон применяется только к файлам, а не к каталогам.
|
||||
Выбирает точно указанный путь к файлу. Этот шаблон применяется
|
||||
только к файлам, но не к директориям.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Выбирает точно указанный путь к каталогу и все внутри.
|
||||
Вы можете использовать любые символы глоббинга, такие как * и ?, но
|
||||
они никогда не совпадают с косой чертой каталога.
|
||||
Этот шаблон применяется только к каталогам, а не к файлам.
|
||||
Выбирает точно указанный путь к директории и все, что находится
|
||||
внутри нее. Этот шаблон применяется только к директориям, но не к файлам.
|
||||
.PP
|
||||
Когда вы указываете абсолютный путь, начинающийся с /, он применяется к
|
||||
корневому каталогу массива, а не к корневому каталогу локальной файловой системы.
|
||||
|
|
|
|||
|
|
@ -1324,32 +1324,61 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
Шаблоны используются для выбора подмножества файлов для исключения или включения
|
||||
в процесс.
|
||||
Шаблоны обеспечивают гибкий способ фильтрации файлов для включения или
|
||||
исключения. Используя символы подстановки (globbing), вы можете определить правила,
|
||||
которые соответствуют конкретным именам файлов или целым структурам каталогов без
|
||||
ручного перечисления каждого пути.
|
||||
|
||||
Вопросительный знак `?` соответствует любому одиночному символу, кроме
|
||||
разделителя каталогов. Это делает его полезным для сопоставления имен файлов с
|
||||
переменными символами, при этом шаблон ограничивается одним уровнем каталога.
|
||||
|
||||
Одиночная звездочка `*` соответствует любой последовательности символов, но, как и
|
||||
вопросительный знак, она никогда не пересекает границы каталогов. Она останавливается на
|
||||
прямой косой черте, что делает ее подходящей для сопоставления внутри одного
|
||||
компонента пути. Это стандартное поведение подстановочных знаков, знакомое
|
||||
по оболочке (shell).
|
||||
|
||||
Двойная звездочка `**` более мощная, она соответствует любой последовательности
|
||||
символов, включая разделители каталогов. Это позволяет шаблонам соответствовать
|
||||
нескольким уровням каталогов. Когда `**` появляется непосредственно в
|
||||
шаблоне, она может соответствовать нулю или более символам, включая косые черты между
|
||||
окружающим буквальным текстом.
|
||||
|
||||
Наиболее важным использованием `**` является специальная форма `/**/`. Она соответствует
|
||||
нулю или более полным уровням каталогов, что позволяет сопоставлять файлы
|
||||
на любой глубине в дереве каталогов, не зная точной структуры пути.
|
||||
Например, шаблон `src/**/main.js` соответствует `src/main.js` (пропуск
|
||||
ноля каталогов), `src/ui/main.js` (пропуск одного каталога) и
|
||||
`src/ui/components/main.js` (пропуск двух каталогов).
|
||||
|
||||
Классы символов с использованием квадратных скобок `[]` соответствуют одному символу из
|
||||
заданного набора или диапазона. Как и другие односимвольные шаблоны, они
|
||||
не соответствуют разделителям каталогов. Классы поддерживают диапазоны и отрицание с
|
||||
использованием восклицательного знака.
|
||||
|
||||
Фундаментальное различие, которое следует помнить, заключается в том, что `*`, `?` и классы
|
||||
символов соблюдают границы каталогов и соответствуют только внутри одного
|
||||
компонента пути, в то время как `**` — единственный шаблон, который может соответствовать
|
||||
через разделители каталогов.
|
||||
|
||||
Существует четыре различных типа шаблонов:
|
||||
|
||||
=FILE
|
||||
Выбирает любой файл с именем FILE. Вы можете использовать любые символы
|
||||
глоббинга, такие как * и ?, и классы символов, такие как [a-z].
|
||||
Этот шаблон применяется только к файлам, а не к каталогам.
|
||||
Выбирает любой файл с именем FILE.
|
||||
Этот шаблон применяется только к файлам, но не к директориям.
|
||||
|
||||
=DIR/
|
||||
Выбирает любой каталог с именем DIR и все внутри.
|
||||
Вы можете использовать любые символы глоббинга, такие как * и ?.
|
||||
Этот шаблон применяется только к каталогам, а не к файлам.
|
||||
Выбирает любую директорию с именем DIR и все, что находится внутри нее.
|
||||
Этот шаблон применяется только к директориям, но не к файлам.
|
||||
|
||||
=/PATH/FILE
|
||||
Выбирает точно указанный путь к файлу. Вы можете использовать любые
|
||||
символы глоббинга, такие как * и ?, но они никогда не совпадают с
|
||||
косой чертой каталога.
|
||||
Этот шаблон применяется только к файлам, а не к каталогам.
|
||||
Выбирает точно указанный путь к файлу. Этот шаблон применяется
|
||||
только к файлам, но не к директориям.
|
||||
|
||||
=/PATH/DIR/
|
||||
Выбирает точно указанный путь к каталогу и все внутри.
|
||||
Вы можете использовать любые символы глоббинга, такие как * и ?, но
|
||||
они никогда не совпадают с косой чертой каталога.
|
||||
Этот шаблон применяется только к каталогам, а не к файлам.
|
||||
Выбирает точно указанный путь к директории и все, что находится
|
||||
внутри нее. Этот шаблон применяется только к директориям, но не к файлам.
|
||||
|
||||
Когда вы указываете абсолютный путь, начинающийся с /, он применяется к
|
||||
корневому каталогу массива, а не к корневому каталогу локальной файловой системы.
|
||||
|
|
|
|||
|
|
@ -1423,32 +1423,61 @@ PARITY — это одно из имен четности: `parity`, `2-parity`,
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
Шаблоны используются для выбора подмножества файлов для исключения или включения
|
||||
в процесс.
|
||||
Шаблоны обеспечивают гибкий способ фильтрации файлов для включения или
|
||||
исключения. Используя символы подстановки (globbing), вы можете определить правила,
|
||||
которые соответствуют конкретным именам файлов или целым структурам каталогов без
|
||||
ручного перечисления каждого пути.
|
||||
|
||||
Вопросительный знак `?` соответствует любому одиночному символу, кроме
|
||||
разделителя каталогов. Это делает его полезным для сопоставления имен файлов с
|
||||
переменными символами, при этом шаблон ограничивается одним уровнем каталога.
|
||||
|
||||
Одиночная звездочка `*` соответствует любой последовательности символов, но, как и
|
||||
вопросительный знак, она никогда не пересекает границы каталогов. Она останавливается на
|
||||
прямой косой черте, что делает ее подходящей для сопоставления внутри одного
|
||||
компонента пути. Это стандартное поведение подстановочных знаков, знакомое
|
||||
по оболочке (shell).
|
||||
|
||||
Двойная звездочка `**` более мощная, она соответствует любой последовательности
|
||||
символов, включая разделители каталогов. Это позволяет шаблонам соответствовать
|
||||
нескольким уровням каталогов. Когда `**` появляется непосредственно в
|
||||
шаблоне, она может соответствовать нулю или более символам, включая косые черты между
|
||||
окружающим буквальным текстом.
|
||||
|
||||
Наиболее важным использованием `**` является специальная форма `/**/`. Она соответствует
|
||||
нулю или более полным уровням каталогов, что позволяет сопоставлять файлы
|
||||
на любой глубине в дереве каталогов, не зная точной структуры пути.
|
||||
Например, шаблон `src/**/main.js` соответствует `src/main.js` (пропуск
|
||||
ноля каталогов), `src/ui/main.js` (пропуск одного каталога) и
|
||||
`src/ui/components/main.js` (пропуск двух каталогов).
|
||||
|
||||
Классы символов с использованием квадратных скобок `[]` соответствуют одному символу из
|
||||
заданного набора или диапазона. Как и другие односимвольные шаблоны, они
|
||||
не соответствуют разделителям каталогов. Классы поддерживают диапазоны и отрицание с
|
||||
использованием восклицательного знака.
|
||||
|
||||
Фундаментальное различие, которое следует помнить, заключается в том, что `*`, `?` и классы
|
||||
символов соблюдают границы каталогов и соответствуют только внутри одного
|
||||
компонента пути, в то время как `**` — единственный шаблон, который может соответствовать
|
||||
через разделители каталогов.
|
||||
|
||||
Существует четыре различных типа шаблонов:
|
||||
|
||||
FILE
|
||||
Выбирает любой файл с именем FILE. Вы можете использовать любые символы
|
||||
глоббинга, такие как * и ?, и классы символов, такие как [a-z].
|
||||
Этот шаблон применяется только к файлам, а не к каталогам.
|
||||
Выбирает любой файл с именем FILE.
|
||||
Этот шаблон применяется только к файлам, но не к директориям.
|
||||
|
||||
DIR/
|
||||
Выбирает любой каталог с именем DIR и все внутри.
|
||||
Вы можете использовать любые символы глоббинга, такие как * и ?.
|
||||
Этот шаблон применяется только к каталогам, а не к файлам.
|
||||
Выбирает любую директорию с именем DIR и все, что находится внутри нее.
|
||||
Этот шаблон применяется только к директориям, но не к файлам.
|
||||
|
||||
/PATH/FILE
|
||||
Выбирает точно указанный путь к файлу. Вы можете использовать любые
|
||||
символы глоббинга, такие как * и ?, но они никогда не совпадают с
|
||||
косой чертой каталога.
|
||||
Этот шаблон применяется только к файлам, а не к каталогам.
|
||||
Выбирает точно указанный путь к файлу. Этот шаблон применяется
|
||||
только к файлам, но не к директориям.
|
||||
|
||||
/PATH/DIR/
|
||||
Выбирает точно указанный путь к каталогу и все внутри.
|
||||
Вы можете использовать любые символы глоббинга, такие как * и ?, но
|
||||
они никогда не совпадают с косой чертой каталога.
|
||||
Этот шаблон применяется только к каталогам, а не к файлам.
|
||||
Выбирает точно указанный путь к директории и все, что находится
|
||||
внутри нее. Этот шаблон применяется только к директориям, но не к файлам.
|
||||
|
||||
Когда вы указываете абсолютный путь, начинающийся с /, он применяется к
|
||||
корневому каталогу массива, а не к корневому каталогу локальной файловой системы.
|
||||
|
|
|
|||
|
|
@ -1697,33 +1697,62 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD 0
|
||||
.PD
|
||||
.RE
|
||||
.SH MöNSTER
|
||||
Mönster används för att välja en delmängd av filer att exkludera eller inkludera i
|
||||
processen.
|
||||
.SH MöNSTER (PATTERN)
|
||||
Mönster ger ett flexibelt sätt att filtrera filer för inkludering eller
|
||||
exkludering. Genom att använda jokertecken kan du definiera regler som
|
||||
matchar specifika filnamn eller hela katalogstrukturer utan att
|
||||
lista varje sökväg manuellt.
|
||||
.PP
|
||||
Frågetecknet \`?\` matchar valfritt enskilt tecken utom katalogavgränsaren.
|
||||
Detta gör det användbart för att matcha filnamn med variabla tecken
|
||||
samtidigt som mönstret hålls begränsat till en enda katalognivå.
|
||||
.PP
|
||||
Den enkla stjärnan \`*\` matchar valfri teckensekvens, men precis som
|
||||
frågetecknet korsar den aldrig kataloggränser. Den stannar vid
|
||||
snedstrecket, vilket gör den lämplig för matchning inom en enskild
|
||||
sökvägskomponent. Detta är det standardbeteende för jokertecken som är
|
||||
bekant från skal\-globbing.
|
||||
.PP
|
||||
Den dubbla stjärnan \`**\` är mer kraftfull; den matchar valfri teckensekvens
|
||||
inklusive katalogavgränsare. Detta gör att mönster kan matcha över
|
||||
flera katalognivåer. När \`**\` förekommer direkt i ett mönster kan det
|
||||
matcha noll eller fler tecken inklusive snedstreck mellan den
|
||||
omkringliggande bokstavliga texten.
|
||||
.PP
|
||||
Den viktigaste användningen av \`**\` är i den speciella formen \`/**/\`. Detta matchar
|
||||
noll eller flera kompletta katalognivåer, vilket gör det möjligt att matcha filer
|
||||
på valfritt djup i ett katalogträd utan att känna till den exakta sökvägsstrukturen.
|
||||
Till exempel matchar mönstret \`src/**/main.js\` filerna \`src/main.js\` (hoppar över
|
||||
noll kataloger), \`src/ui/main.js\` (hoppar över en katalog) och
|
||||
\`src/ui/components/main.js\` (hoppar över två kataloger).
|
||||
.PP
|
||||
Teckenklasser som använder hakparenteser \`[]\` matchar ett enskilt tecken från en
|
||||
angiven uppsättning eller ett intervall. Precis som de andra mönstren för enskilda
|
||||
tecken matchar de inte katalogavgränsare. Klasser stöder intervall och
|
||||
negering med ett utropstecken.
|
||||
.PP
|
||||
Den grundläggande skillnaden att komma ihåg är att \`*\`, \`?\` och teckenklasser
|
||||
alla respekterar kataloggränser och endast matchar inom en enskild
|
||||
sökvägskomponent, medan \`**\` är det enda mönstret som kan matcha över
|
||||
katalogavgränsare.
|
||||
.PP
|
||||
Det finns fyra olika typer av mönster:
|
||||
.TP
|
||||
.B FIL
|
||||
Väljer alla filer som heter FIL. Du kan använda alla globbing\-
|
||||
tecken som * och ?, och teckenklasser som [a\-z].
|
||||
Detta mönster gäller endast för filer, inte kataloger.
|
||||
.B FILE
|
||||
Väljer valfri fil med namnet FILE.
|
||||
Detta mönster gäller endast filer, inte kataloger.
|
||||
.TP
|
||||
.B KATALOG/
|
||||
Väljer alla kataloger som heter KATALOG och allt inuti.
|
||||
Du kan använda alla globbing\-tecken som * och ?.
|
||||
Detta mönster gäller endast för kataloger, inte filer.
|
||||
.B DIR/
|
||||
Väljer valfri katalog med namnet DIR och allt innehåll.
|
||||
Detta mönster gäller endast kataloger, inte filer.
|
||||
.TP
|
||||
.B /SÖKVÄG/FIL
|
||||
Väljer den exakt specificerade filsökvägen. Du kan använda alla
|
||||
globbing\-tecken som * och ?, men de matchar aldrig ett
|
||||
katalog\-snedstreck.
|
||||
Detta mönster gäller endast för filer, inte kataloger.
|
||||
.B /PATH/FILE
|
||||
Väljer den exakt angivna filsökvägen. Detta mönster gäller
|
||||
endast filer, inte kataloger.
|
||||
.TP
|
||||
.B /SÖKVÄG/KATALOG/
|
||||
Väljer den exakt specificerade katalogsökvägen och allt
|
||||
inuti. Du kan använda alla globbing\-tecken som * och ?, men
|
||||
de matchar aldrig ett katalog\-snedstreck.
|
||||
Detta mönster gäller endast för kataloger, inte filer.
|
||||
.B /PATH/DIR/
|
||||
Väljer den exakt angivna katalogsökvägen och allt innehåll.
|
||||
Detta mönster gäller endast kataloger, inte filer.
|
||||
.PP
|
||||
När du specificerar en absolut sökväg som börjar med /, tillämpas den vid
|
||||
array\-rotkatalogen, inte den lokala filsystemets rotkatalog.
|
||||
|
|
|
|||
|
|
@ -1324,33 +1324,62 @@ Konfiguration
|
|||
:smartctl parity -d areca,1/1 /dev/arcmsr0
|
||||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Mönster
|
||||
Mönster används för att välja en delmängd av filer att exkludera eller inkludera i
|
||||
processen.
|
||||
Mönster (Pattern)
|
||||
Mönster ger ett flexibelt sätt att filtrera filer för inkludering eller
|
||||
exkludering. Genom att använda jokertecken kan du definiera regler som
|
||||
matchar specifika filnamn eller hela katalogstrukturer utan att
|
||||
lista varje sökväg manuellt.
|
||||
|
||||
Frågetecknet `?` matchar valfritt enskilt tecken utom katalogavgränsaren.
|
||||
Detta gör det användbart för att matcha filnamn med variabla tecken
|
||||
samtidigt som mönstret hålls begränsat till en enda katalognivå.
|
||||
|
||||
Den enkla stjärnan `*` matchar valfri teckensekvens, men precis som
|
||||
frågetecknet korsar den aldrig kataloggränser. Den stannar vid
|
||||
snedstrecket, vilket gör den lämplig för matchning inom en enskild
|
||||
sökvägskomponent. Detta är det standardbeteende för jokertecken som är
|
||||
bekant från skal-globbing.
|
||||
|
||||
Den dubbla stjärnan `**` är mer kraftfull; den matchar valfri teckensekvens
|
||||
inklusive katalogavgränsare. Detta gör att mönster kan matcha över
|
||||
flera katalognivåer. När `**` förekommer direkt i ett mönster kan det
|
||||
matcha noll eller fler tecken inklusive snedstreck mellan den
|
||||
omkringliggande bokstavliga texten.
|
||||
|
||||
Den viktigaste användningen av `**` är i den speciella formen `/**/`. Detta matchar
|
||||
noll eller flera kompletta katalognivåer, vilket gör det möjligt att matcha filer
|
||||
på valfritt djup i ett katalogträd utan att känna till den exakta sökvägsstrukturen.
|
||||
Till exempel matchar mönstret `src/**/main.js` filerna `src/main.js` (hoppar över
|
||||
noll kataloger), `src/ui/main.js` (hoppar över en katalog) och
|
||||
`src/ui/components/main.js` (hoppar över två kataloger).
|
||||
|
||||
Teckenklasser som använder hakparenteser `[]` matchar ett enskilt tecken från en
|
||||
angiven uppsättning eller ett intervall. Precis som de andra mönstren för enskilda
|
||||
tecken matchar de inte katalogavgränsare. Klasser stöder intervall och
|
||||
negering med ett utropstecken.
|
||||
|
||||
Den grundläggande skillnaden att komma ihåg är att `*`, `?` och teckenklasser
|
||||
alla respekterar kataloggränser och endast matchar inom en enskild
|
||||
sökvägskomponent, medan `**` är det enda mönstret som kan matcha över
|
||||
katalogavgränsare.
|
||||
|
||||
Det finns fyra olika typer av mönster:
|
||||
|
||||
=FIL
|
||||
Väljer alla filer som heter FIL. Du kan använda alla globbing-
|
||||
tecken som * och ?, och teckenklasser som [a-z].
|
||||
Detta mönster gäller endast för filer, inte kataloger.
|
||||
=FILE
|
||||
Väljer valfri fil med namnet FILE.
|
||||
Detta mönster gäller endast filer, inte kataloger.
|
||||
|
||||
=KATALOG/
|
||||
Väljer alla kataloger som heter KATALOG och allt inuti.
|
||||
Du kan använda alla globbing-tecken som * och ?.
|
||||
Detta mönster gäller endast för kataloger, inte filer.
|
||||
=DIR/
|
||||
Väljer valfri katalog med namnet DIR och allt innehåll.
|
||||
Detta mönster gäller endast kataloger, inte filer.
|
||||
|
||||
=/SÖKVÄG/FIL
|
||||
Väljer den exakt specificerade filsökvägen. Du kan använda alla
|
||||
globbing-tecken som * och ?, men de matchar aldrig ett
|
||||
katalog-snedstreck.
|
||||
Detta mönster gäller endast för filer, inte kataloger.
|
||||
=/PATH/FILE
|
||||
Väljer den exakt angivna filsökvägen. Detta mönster gäller
|
||||
endast filer, inte kataloger.
|
||||
|
||||
=/SÖKVÄG/KATALOG/
|
||||
Väljer den exakt specificerade katalogsökvägen och allt
|
||||
inuti. Du kan använda alla globbing-tecken som * och ?, men
|
||||
de matchar aldrig ett katalog-snedstreck.
|
||||
Detta mönster gäller endast för kataloger, inte filer.
|
||||
=/PATH/DIR/
|
||||
Väljer den exakt angivna katalogsökvägen och allt innehåll.
|
||||
Detta mönster gäller endast kataloger, inte filer.
|
||||
|
||||
När du specificerar en absolut sökväg som börjar med /, tillämpas den vid
|
||||
array-rotkatalogen, inte den lokala filsystemets rotkatalog.
|
||||
|
|
|
|||
|
|
@ -1421,35 +1421,64 @@ Ett exempel på en typisk konfiguration för Windows är:
|
|||
smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
|
||||
8 MöNSTER
|
||||
=========
|
||||
8 MöNSTER (PATTERN)
|
||||
===================
|
||||
|
||||
Mönster används för att välja en delmängd av filer att exkludera eller inkludera i
|
||||
processen.
|
||||
Mönster ger ett flexibelt sätt att filtrera filer för inkludering eller
|
||||
exkludering. Genom att använda jokertecken kan du definiera regler som
|
||||
matchar specifika filnamn eller hela katalogstrukturer utan att
|
||||
lista varje sökväg manuellt.
|
||||
|
||||
Frågetecknet `?` matchar valfritt enskilt tecken utom katalogavgränsaren.
|
||||
Detta gör det användbart för att matcha filnamn med variabla tecken
|
||||
samtidigt som mönstret hålls begränsat till en enda katalognivå.
|
||||
|
||||
Den enkla stjärnan `*` matchar valfri teckensekvens, men precis som
|
||||
frågetecknet korsar den aldrig kataloggränser. Den stannar vid
|
||||
snedstrecket, vilket gör den lämplig för matchning inom en enskild
|
||||
sökvägskomponent. Detta är det standardbeteende för jokertecken som är
|
||||
bekant från skal-globbing.
|
||||
|
||||
Den dubbla stjärnan `**` är mer kraftfull; den matchar valfri teckensekvens
|
||||
inklusive katalogavgränsare. Detta gör att mönster kan matcha över
|
||||
flera katalognivåer. När `**` förekommer direkt i ett mönster kan det
|
||||
matcha noll eller fler tecken inklusive snedstreck mellan den
|
||||
omkringliggande bokstavliga texten.
|
||||
|
||||
Den viktigaste användningen av `**` är i den speciella formen `/**/`. Detta matchar
|
||||
noll eller flera kompletta katalognivåer, vilket gör det möjligt att matcha filer
|
||||
på valfritt djup i ett katalogträd utan att känna till den exakta sökvägsstrukturen.
|
||||
Till exempel matchar mönstret `src/**/main.js` filerna `src/main.js` (hoppar över
|
||||
noll kataloger), `src/ui/main.js` (hoppar över en katalog) och
|
||||
`src/ui/components/main.js` (hoppar över två kataloger).
|
||||
|
||||
Teckenklasser som använder hakparenteser `[]` matchar ett enskilt tecken från en
|
||||
angiven uppsättning eller ett intervall. Precis som de andra mönstren för enskilda
|
||||
tecken matchar de inte katalogavgränsare. Klasser stöder intervall och
|
||||
negering med ett utropstecken.
|
||||
|
||||
Den grundläggande skillnaden att komma ihåg är att `*`, `?` och teckenklasser
|
||||
alla respekterar kataloggränser och endast matchar inom en enskild
|
||||
sökvägskomponent, medan `**` är det enda mönstret som kan matcha över
|
||||
katalogavgränsare.
|
||||
|
||||
Det finns fyra olika typer av mönster:
|
||||
|
||||
FIL
|
||||
Väljer alla filer som heter FIL. Du kan använda alla globbing-
|
||||
tecken som * och ?, och teckenklasser som [a-z].
|
||||
Detta mönster gäller endast för filer, inte kataloger.
|
||||
FILE
|
||||
Väljer valfri fil med namnet FILE.
|
||||
Detta mönster gäller endast filer, inte kataloger.
|
||||
|
||||
KATALOG/
|
||||
Väljer alla kataloger som heter KATALOG och allt inuti.
|
||||
Du kan använda alla globbing-tecken som * och ?.
|
||||
Detta mönster gäller endast för kataloger, inte filer.
|
||||
DIR/
|
||||
Väljer valfri katalog med namnet DIR och allt innehåll.
|
||||
Detta mönster gäller endast kataloger, inte filer.
|
||||
|
||||
/SÖKVÄG/FIL
|
||||
Väljer den exakt specificerade filsökvägen. Du kan använda alla
|
||||
globbing-tecken som * och ?, men de matchar aldrig ett
|
||||
katalog-snedstreck.
|
||||
Detta mönster gäller endast för filer, inte kataloger.
|
||||
/PATH/FILE
|
||||
Väljer den exakt angivna filsökvägen. Detta mönster gäller
|
||||
endast filer, inte kataloger.
|
||||
|
||||
/SÖKVÄG/KATALOG/
|
||||
Väljer den exakt specificerade katalogsökvägen och allt
|
||||
inuti. Du kan använda alla globbing-tecken som * och ?, men
|
||||
de matchar aldrig ett katalog-snedstreck.
|
||||
Detta mönster gäller endast för kataloger, inte filer.
|
||||
/PATH/DIR/
|
||||
Väljer den exakt angivna katalogsökvägen och allt innehåll.
|
||||
Detta mönster gäller endast kataloger, inte filer.
|
||||
|
||||
När du specificerar en absolut sökväg som börjar med /, tillämpas den vid
|
||||
array-rotkatalogen, inte den lokala filsystemets rotkatalog.
|
||||
|
|
|
|||
|
|
@ -1877,40 +1877,61 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH Шаблон (PATTERN)
|
||||
Шаблони використовуються для вибору підмножини файлів
|
||||
для виключення або включення в процес.
|
||||
Шаблони забезпечують гнучкий спосіб фільтрації файлів для включення або
|
||||
виключення. Використовуючи символи підстановки (globbing), ви можете визначити правила, які
|
||||
відповідають конкретним іменам файлів або цілим структурам каталогів без
|
||||
ручного перерахування кожного шляху.
|
||||
.PP
|
||||
Знак питання \`?\` відповідає будь\-якому одному символу, крім роздільника
|
||||
каталогів. Це робить його корисним для зіставлення імен файлів із змінними
|
||||
символами, при цьому шаблон обмежується одним рівнем каталогу.
|
||||
.PP
|
||||
Одинарна зірочка \`*\` відповідає будь\-якій послідовності символів, але, як і
|
||||
знак питання, вона ніколи не перетинає межі каталогів. Вона зупиняється на
|
||||
прямій косій рисці, що робить її придатною для зіставлення всередині одного
|
||||
компонента шляху. Це стандартна поведінка підстановочних знаків, знайома
|
||||
з командної оболонки (shell globbing).
|
||||
.PP
|
||||
Подвійна зірочка \`**\` є потужнішою, вона відповідає будь\-якій послідовності
|
||||
символів, включаючи роздільники каталогів. Це дозволяє шаблонам відповідати
|
||||
кільком рівням каталогів. Коли \`**\` з\'являється безпосередньо в шаблоні,
|
||||
вона може відповідати нулю або більше символам, включаючи косі риски між
|
||||
оточуючим літеральним текстом.
|
||||
.PP
|
||||
Найважливішим використанням \`**\` є спеціальна форма \`/**/\`. Вона відповідає
|
||||
нулю або більше повним рівням каталогів, що дозволяє зіставляти файли
|
||||
на будь\-якій глибині в дереві каталогів, не знаючи точної структури шляху.
|
||||
Наприклад, шаблон \`src/**/main.js\` відповідає \`src/main.js\` (пропуск
|
||||
нуля каталогів), \`src/ui/main.js\` (пропуск одного каталогу) та
|
||||
\`src/ui/components/main.js\` (пропуск двох каталогів).
|
||||
.PP
|
||||
Класи символів із використанням квадратних дужок \`[]\` відповідають одному символу з
|
||||
визначеного набору або діапазону. Як і інші односимвольні шаблони, вони
|
||||
не відповідають роздільникам каталогів. Класи підтримують діапазони та заперечення за допомогою
|
||||
знаку оклику.
|
||||
.PP
|
||||
Фундаментальна відмінність, яку слід пам\'ятати, полягає в тому, що \`*\`, \`?\` та класи символів
|
||||
усі дотримуються меж каталогів і відповідають лише в межах одного компонента
|
||||
шляху, тоді як \`**\` — єдиний шаблон, який може відповідати через роздільники
|
||||
каталогів.
|
||||
.PP
|
||||
Існує чотири різні типи шаблонів:
|
||||
.TP
|
||||
.B FILE
|
||||
Вибирає будь\-який файл з іменем FILE. Ви можете
|
||||
використовувати будь\-які символи глоббінгу,
|
||||
такі як * та ?, та класи символів, такі як [a\-z].
|
||||
Цей шаблон застосовується лише до файлів, а не
|
||||
до каталогів.
|
||||
Вибирає будь\-який файл з ім\'ям FILE.
|
||||
Цей шаблон застосовується тільки до файлів, а не до директорій.
|
||||
.TP
|
||||
.B DIR/
|
||||
Вибирає будь\-який каталог з іменем DIR та все
|
||||
всередині. Ви можете використовувати будь\-які
|
||||
символи глоббінгу, такі як * та ?.
|
||||
Цей шаблон застосовується лише до каталогів,
|
||||
а не до файлів.
|
||||
Вибирає будь\-яку директорію з ім\'ям DIR і все, що знаходиться всередині.
|
||||
Цей шаблон застосовується тільки до директорій, а не до файлів.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Вибирає точно вказаний шлях до файлу. Ви можете
|
||||
використовувати будь\-які символи глоббінгу, такі
|
||||
як * та ?, але вони ніколи не збігаються з
|
||||
похилою рискою каталогу.
|
||||
Цей шаблон застосовується лише до файлів,
|
||||
а не до каталогів.
|
||||
Вибирає точно вказаний шлях до файлу. Цей шаблон застосовується
|
||||
тільки до файлів, а не до директорій.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Вибирає точно вказаний шлях до каталогу та все
|
||||
всередині. Ви можете використовувати будь\-які
|
||||
символи глоббінгу, такі як * та ?, але вони
|
||||
ніколи не збігаються з похилою рискою каталогу.
|
||||
Цей шаблон застосовується лише до каталогів,
|
||||
а не до файлів.
|
||||
Вибирає точно вказаний шлях до директорії і все, що знаходиться
|
||||
всередині. Цей шаблон застосовується тільки до директорій, а не до файлів.
|
||||
.PP
|
||||
Коли ви вказуєте абсолютний шлях, що починається
|
||||
з /, він застосовується до кореневого каталогу
|
||||
|
|
|
|||
|
|
@ -1493,40 +1493,61 @@ Name{number}
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Шаблон (Pattern)
|
||||
Шаблони використовуються для вибору підмножини файлів
|
||||
для виключення або включення в процес.
|
||||
Шаблони забезпечують гнучкий спосіб фільтрації файлів для включення або
|
||||
виключення. Використовуючи символи підстановки (globbing), ви можете визначити правила, які
|
||||
відповідають конкретним іменам файлів або цілим структурам каталогів без
|
||||
ручного перерахування кожного шляху.
|
||||
|
||||
Знак питання `?` відповідає будь-якому одному символу, крім роздільника
|
||||
каталогів. Це робить його корисним для зіставлення імен файлів із змінними
|
||||
символами, при цьому шаблон обмежується одним рівнем каталогу.
|
||||
|
||||
Одинарна зірочка `*` відповідає будь-якій послідовності символів, але, як і
|
||||
знак питання, вона ніколи не перетинає межі каталогів. Вона зупиняється на
|
||||
прямій косій рисці, що робить її придатною для зіставлення всередині одного
|
||||
компонента шляху. Це стандартна поведінка підстановочних знаків, знайома
|
||||
з командної оболонки (shell globbing).
|
||||
|
||||
Подвійна зірочка `**` є потужнішою, вона відповідає будь-якій послідовності
|
||||
символів, включаючи роздільники каталогів. Це дозволяє шаблонам відповідати
|
||||
кільком рівням каталогів. Коли `**` з'являється безпосередньо в шаблоні,
|
||||
вона може відповідати нулю або більше символам, включаючи косі риски між
|
||||
оточуючим літеральним текстом.
|
||||
|
||||
Найважливішим використанням `**` є спеціальна форма `/**/`. Вона відповідає
|
||||
нулю або більше повним рівням каталогів, що дозволяє зіставляти файли
|
||||
на будь-якій глибині в дереві каталогів, не знаючи точної структури шляху.
|
||||
Наприклад, шаблон `src/**/main.js` відповідає `src/main.js` (пропуск
|
||||
нуля каталогів), `src/ui/main.js` (пропуск одного каталогу) та
|
||||
`src/ui/components/main.js` (пропуск двох каталогів).
|
||||
|
||||
Класи символів із використанням квадратних дужок `[]` відповідають одному символу з
|
||||
визначеного набору або діапазону. Як і інші односимвольні шаблони, вони
|
||||
не відповідають роздільникам каталогів. Класи підтримують діапазони та заперечення за допомогою
|
||||
знаку оклику.
|
||||
|
||||
Фундаментальна відмінність, яку слід пам'ятати, полягає в тому, що `*`, `?` та класи символів
|
||||
усі дотримуються меж каталогів і відповідають лише в межах одного компонента
|
||||
шляху, тоді як `**` — єдиний шаблон, який може відповідати через роздільники
|
||||
каталогів.
|
||||
|
||||
Існує чотири різні типи шаблонів:
|
||||
|
||||
=FILE
|
||||
Вибирає будь-який файл з іменем FILE. Ви можете
|
||||
використовувати будь-які символи глоббінгу,
|
||||
такі як * та ?, та класи символів, такі як [a-z].
|
||||
Цей шаблон застосовується лише до файлів, а не
|
||||
до каталогів.
|
||||
Вибирає будь-який файл з ім'ям FILE.
|
||||
Цей шаблон застосовується тільки до файлів, а не до директорій.
|
||||
|
||||
=DIR/
|
||||
Вибирає будь-який каталог з іменем DIR та все
|
||||
всередині. Ви можете використовувати будь-які
|
||||
символи глоббінгу, такі як * та ?.
|
||||
Цей шаблон застосовується лише до каталогів,
|
||||
а не до файлів.
|
||||
Вибирає будь-яку директорію з ім'ям DIR і все, що знаходиться всередині.
|
||||
Цей шаблон застосовується тільки до директорій, а не до файлів.
|
||||
|
||||
=/PATH/FILE
|
||||
Вибирає точно вказаний шлях до файлу. Ви можете
|
||||
використовувати будь-які символи глоббінгу, такі
|
||||
як * та ?, але вони ніколи не збігаються з
|
||||
похилою рискою каталогу.
|
||||
Цей шаблон застосовується лише до файлів,
|
||||
а не до каталогів.
|
||||
Вибирає точно вказаний шлях до файлу. Цей шаблон застосовується
|
||||
тільки до файлів, а не до директорій.
|
||||
|
||||
=/PATH/DIR/
|
||||
Вибирає точно вказаний шлях до каталогу та все
|
||||
всередині. Ви можете використовувати будь-які
|
||||
символи глоббінгу, такі як * та ?, але вони
|
||||
ніколи не збігаються з похилою рискою каталогу.
|
||||
Цей шаблон застосовується лише до каталогів,
|
||||
а не до файлів.
|
||||
Вибирає точно вказаний шлях до директорії і все, що знаходиться
|
||||
всередині. Цей шаблон застосовується тільки до директорій, а не до файлів.
|
||||
|
||||
Коли ви вказуєте абсолютний шлях, що починається
|
||||
з /, він застосовується до кореневого каталогу
|
||||
|
|
|
|||
|
|
@ -1592,40 +1592,61 @@ PARITY — це одне з імен парності: `parity`,
|
|||
8 Шаблон (PATTERN)
|
||||
==================
|
||||
|
||||
Шаблони використовуються для вибору підмножини файлів
|
||||
для виключення або включення в процес.
|
||||
Шаблони забезпечують гнучкий спосіб фільтрації файлів для включення або
|
||||
виключення. Використовуючи символи підстановки (globbing), ви можете визначити правила, які
|
||||
відповідають конкретним іменам файлів або цілим структурам каталогів без
|
||||
ручного перерахування кожного шляху.
|
||||
|
||||
Знак питання `?` відповідає будь-якому одному символу, крім роздільника
|
||||
каталогів. Це робить його корисним для зіставлення імен файлів із змінними
|
||||
символами, при цьому шаблон обмежується одним рівнем каталогу.
|
||||
|
||||
Одинарна зірочка `*` відповідає будь-якій послідовності символів, але, як і
|
||||
знак питання, вона ніколи не перетинає межі каталогів. Вона зупиняється на
|
||||
прямій косій рисці, що робить її придатною для зіставлення всередині одного
|
||||
компонента шляху. Це стандартна поведінка підстановочних знаків, знайома
|
||||
з командної оболонки (shell globbing).
|
||||
|
||||
Подвійна зірочка `**` є потужнішою, вона відповідає будь-якій послідовності
|
||||
символів, включаючи роздільники каталогів. Це дозволяє шаблонам відповідати
|
||||
кільком рівням каталогів. Коли `**` з'являється безпосередньо в шаблоні,
|
||||
вона може відповідати нулю або більше символам, включаючи косі риски між
|
||||
оточуючим літеральним текстом.
|
||||
|
||||
Найважливішим використанням `**` є спеціальна форма `/**/`. Вона відповідає
|
||||
нулю або більше повним рівням каталогів, що дозволяє зіставляти файли
|
||||
на будь-якій глибині в дереві каталогів, не знаючи точної структури шляху.
|
||||
Наприклад, шаблон `src/**/main.js` відповідає `src/main.js` (пропуск
|
||||
нуля каталогів), `src/ui/main.js` (пропуск одного каталогу) та
|
||||
`src/ui/components/main.js` (пропуск двох каталогів).
|
||||
|
||||
Класи символів із використанням квадратних дужок `[]` відповідають одному символу з
|
||||
визначеного набору або діапазону. Як і інші односимвольні шаблони, вони
|
||||
не відповідають роздільникам каталогів. Класи підтримують діапазони та заперечення за допомогою
|
||||
знаку оклику.
|
||||
|
||||
Фундаментальна відмінність, яку слід пам'ятати, полягає в тому, що `*`, `?` та класи символів
|
||||
усі дотримуються меж каталогів і відповідають лише в межах одного компонента
|
||||
шляху, тоді як `**` — єдиний шаблон, який може відповідати через роздільники
|
||||
каталогів.
|
||||
|
||||
Існує чотири різні типи шаблонів:
|
||||
|
||||
FILE
|
||||
Вибирає будь-який файл з іменем FILE. Ви можете
|
||||
використовувати будь-які символи глоббінгу,
|
||||
такі як * та ?, та класи символів, такі як [a-z].
|
||||
Цей шаблон застосовується лише до файлів, а не
|
||||
до каталогів.
|
||||
Вибирає будь-який файл з ім'ям FILE.
|
||||
Цей шаблон застосовується тільки до файлів, а не до директорій.
|
||||
|
||||
DIR/
|
||||
Вибирає будь-який каталог з іменем DIR та все
|
||||
всередині. Ви можете використовувати будь-які
|
||||
символи глоббінгу, такі як * та ?.
|
||||
Цей шаблон застосовується лише до каталогів,
|
||||
а не до файлів.
|
||||
Вибирає будь-яку директорію з ім'ям DIR і все, що знаходиться всередині.
|
||||
Цей шаблон застосовується тільки до директорій, а не до файлів.
|
||||
|
||||
/PATH/FILE
|
||||
Вибирає точно вказаний шлях до файлу. Ви можете
|
||||
використовувати будь-які символи глоббінгу, такі
|
||||
як * та ?, але вони ніколи не збігаються з
|
||||
похилою рискою каталогу.
|
||||
Цей шаблон застосовується лише до файлів,
|
||||
а не до каталогів.
|
||||
Вибирає точно вказаний шлях до файлу. Цей шаблон застосовується
|
||||
тільки до файлів, а не до директорій.
|
||||
|
||||
/PATH/DIR/
|
||||
Вибирає точно вказаний шлях до каталогу та все
|
||||
всередині. Ви можете використовувати будь-які
|
||||
символи глоббінгу, такі як * та ?, але вони
|
||||
ніколи не збігаються з похилою рискою каталогу.
|
||||
Цей шаблон застосовується лише до каталогів,
|
||||
а не до файлів.
|
||||
Вибирає точно вказаний шлях до директорії і все, що знаходиться
|
||||
всередині. Цей шаблон застосовується тільки до директорій, а не до файлів.
|
||||
|
||||
Коли ви вказуєте абсолютний шлях, що починається
|
||||
з /, він застосовується до кореневого каталогу
|
||||
|
|
|
|||
|
|
@ -1551,31 +1551,49 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.PD
|
||||
.RE
|
||||
.SH PATTERN
|
||||
模式用于选择要排除或包含在过程中的文件子集。
|
||||
模式提供了一种灵活的方法来过滤要包含或排除的文件。通过使用通配符(globbing),
|
||||
您可以定义匹配特定文件名或整个目录结构的规则,而无需手动列出每个路径。
|
||||
.PP
|
||||
问号 \`?\` 匹配除目录分隔符以外的任何单个字符。这使得它在匹配具有变量字符
|
||||
的文件名时非常有用,同时将模式限制在单个目录层级内。
|
||||
.PP
|
||||
单星号 \`*\` 匹配任何字符序列,但与问号一样,它绝不会跨越目录边界。
|
||||
它在正斜杠处停止,因此适用于匹配单个路径组件内的内容。
|
||||
这是 Shell 通配符中常见的标准行为。
|
||||
.PP
|
||||
双星号 \`**\` 功能更强大,它可以匹配任何字符序列,包括目录分隔符。
|
||||
这允许模式匹配跨越多个目录层级。当 \`**\` 直接嵌入在模式中时,
|
||||
它可以匹配零个或多个字符,包括周围文字文本之间的斜杠。
|
||||
.PP
|
||||
\`**\` 最重要的用法是特殊形式 \`/**/\`。它可以匹配零个或多个完整的目录层级,
|
||||
从而可以在不知道确切路径结构的情况下,匹配目录树中任何深度的文件。
|
||||
例如,模式 \`src/**/main.js\` 匹配 \`src/main.js\`(跳过零个目录)、
|
||||
\`src/ui/main.js\`(跳过一个目录)以及 \`src/ui/components/main.js\`
|
||||
(跳过两个目录)。
|
||||
.PP
|
||||
使用方括号 \`[]\` 的字符类匹配指定集合或范围内的单个字符。
|
||||
与其他单字符模式一样,它们不匹配目录分隔符。字符类支持使用
|
||||
感叹号进行范围指定和否定。
|
||||
.PP
|
||||
需要记住的根本区别是,\`*\`、\`?\` 和字符类都遵循目录边界,
|
||||
并且仅在单个路径组件内匹配,而 \`**\` 是唯一可以跨越目录分隔符匹配的模式。
|
||||
.PP
|
||||
有四种不同类型的模式:
|
||||
.TP
|
||||
.B FILE
|
||||
选择任何名为 FILE 的文件。您可以使用任何 globbing
|
||||
字符,如 * 和 ?,以及字符类,如 [a\-z]。
|
||||
选择任何名为 FILE 的文件。
|
||||
此模式仅适用于文件,不适用于目录。
|
||||
.TP
|
||||
.B DIR/
|
||||
选择任何名为 DIR 的目录及其内部的所有内容。
|
||||
您可以使用任何 globbing 字符,如 * 和 ?。
|
||||
此模式仅适用于目录,不适用于文件。
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
选择完全指定的 file path。您可以使用任何
|
||||
globbing 字符,如 * 和 ?,但它们绝不匹配
|
||||
目录斜杠。
|
||||
此模式仅适用于文件,不适用于目录。
|
||||
选择指定的确切文件路径。此模式仅适用于文件,不适用于目录。
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
选择完全指定的 directory path 及其内部的所有内容。
|
||||
您可以使用任何 globbing 字符,如 * 和 ?,但
|
||||
它们绝不匹配目录斜杠。
|
||||
此模式仅适用于目录,不适用于文件。
|
||||
选择指定的确切目录路径及其内部的所有内容。此模式仅适用于目录,
|
||||
不适用于文件。
|
||||
.PP
|
||||
当您指定以 / 开头的绝对路径时,它应用于阵列**根目录**,
|
||||
而不是本地文件系统根目录。
|
||||
|
|
|
|||
|
|
@ -1178,31 +1178,49 @@ Configuration
|
|||
:smartctl 2-parity -d areca,2/1 /dev/arcmsr0
|
||||
|
||||
Pattern
|
||||
模式用于选择要排除或包含在过程中的文件子集。
|
||||
模式提供了一种灵活的方法来过滤要包含或排除的文件。通过使用通配符(globbing),
|
||||
您可以定义匹配特定文件名或整个目录结构的规则,而无需手动列出每个路径。
|
||||
|
||||
问号 `?` 匹配除目录分隔符以外的任何单个字符。这使得它在匹配具有变量字符
|
||||
的文件名时非常有用,同时将模式限制在单个目录层级内。
|
||||
|
||||
单星号 `*` 匹配任何字符序列,但与问号一样,它绝不会跨越目录边界。
|
||||
它在正斜杠处停止,因此适用于匹配单个路径组件内的内容。
|
||||
这是 Shell 通配符中常见的标准行为。
|
||||
|
||||
双星号 `**` 功能更强大,它可以匹配任何字符序列,包括目录分隔符。
|
||||
这允许模式匹配跨越多个目录层级。当 `**` 直接嵌入在模式中时,
|
||||
它可以匹配零个或多个字符,包括周围文字文本之间的斜杠。
|
||||
|
||||
`**` 最重要的用法是特殊形式 `/**/`。它可以匹配零个或多个完整的目录层级,
|
||||
从而可以在不知道确切路径结构的情况下,匹配目录树中任何深度的文件。
|
||||
例如,模式 `src/**/main.js` 匹配 `src/main.js`(跳过零个目录)、
|
||||
`src/ui/main.js`(跳过一个目录)以及 `src/ui/components/main.js`
|
||||
(跳过两个目录)。
|
||||
|
||||
使用方括号 `[]` 的字符类匹配指定集合或范围内的单个字符。
|
||||
与其他单字符模式一样,它们不匹配目录分隔符。字符类支持使用
|
||||
感叹号进行范围指定和否定。
|
||||
|
||||
需要记住的根本区别是,`*`、`?` 和字符类都遵循目录边界,
|
||||
并且仅在单个路径组件内匹配,而 `**` 是唯一可以跨越目录分隔符匹配的模式。
|
||||
|
||||
有四种不同类型的模式:
|
||||
|
||||
=FILE
|
||||
选择任何名为 FILE 的文件。您可以使用任何 globbing
|
||||
字符,如 * 和 ?,以及字符类,如 [a-z]。
|
||||
选择任何名为 FILE 的文件。
|
||||
此模式仅适用于文件,不适用于目录。
|
||||
|
||||
=DIR/
|
||||
选择任何名为 DIR 的目录及其内部的所有内容。
|
||||
您可以使用任何 globbing 字符,如 * 和 ?。
|
||||
此模式仅适用于目录,不适用于文件。
|
||||
|
||||
=/PATH/FILE
|
||||
选择完全指定的 file path。您可以使用任何
|
||||
globbing 字符,如 * 和 ?,但它们绝不匹配
|
||||
目录斜杠。
|
||||
此模式仅适用于文件,不适用于目录。
|
||||
选择指定的确切文件路径。此模式仅适用于文件,不适用于目录。
|
||||
|
||||
=/PATH/DIR/
|
||||
选择完全指定的 directory path 及其内部的所有内容。
|
||||
您可以使用任何 globbing 字符,如 * 和 ?,但
|
||||
它们绝不匹配目录斜杠。
|
||||
此模式仅适用于目录,不适用于文件。
|
||||
选择指定的确切目录路径及其内部的所有内容。此模式仅适用于目录,
|
||||
不适用于文件。
|
||||
|
||||
当您指定以 / 开头的绝对路径时,它应用于阵列**根目录**,
|
||||
而不是本地文件系统根目录。
|
||||
|
|
|
|||
|
|
@ -1277,31 +1277,49 @@ Windows 的典型配置示例如下:
|
|||
8 PATTERN
|
||||
=========
|
||||
|
||||
模式用于选择要排除或包含在过程中的文件子集。
|
||||
模式提供了一种灵活的方法来过滤要包含或排除的文件。通过使用通配符(globbing),
|
||||
您可以定义匹配特定文件名或整个目录结构的规则,而无需手动列出每个路径。
|
||||
|
||||
问号 `?` 匹配除目录分隔符以外的任何单个字符。这使得它在匹配具有变量字符
|
||||
的文件名时非常有用,同时将模式限制在单个目录层级内。
|
||||
|
||||
单星号 `*` 匹配任何字符序列,但与问号一样,它绝不会跨越目录边界。
|
||||
它在正斜杠处停止,因此适用于匹配单个路径组件内的内容。
|
||||
这是 Shell 通配符中常见的标准行为。
|
||||
|
||||
双星号 `**` 功能更强大,它可以匹配任何字符序列,包括目录分隔符。
|
||||
这允许模式匹配跨越多个目录层级。当 `**` 直接嵌入在模式中时,
|
||||
它可以匹配零个或多个字符,包括周围文字文本之间的斜杠。
|
||||
|
||||
`**` 最重要的用法是特殊形式 `/**/`。它可以匹配零个或多个完整的目录层级,
|
||||
从而可以在不知道确切路径结构的情况下,匹配目录树中任何深度的文件。
|
||||
例如,模式 `src/**/main.js` 匹配 `src/main.js`(跳过零个目录)、
|
||||
`src/ui/main.js`(跳过一个目录)以及 `src/ui/components/main.js`
|
||||
(跳过两个目录)。
|
||||
|
||||
使用方括号 `[]` 的字符类匹配指定集合或范围内的单个字符。
|
||||
与其他单字符模式一样,它们不匹配目录分隔符。字符类支持使用
|
||||
感叹号进行范围指定和否定。
|
||||
|
||||
需要记住的根本区别是,`*`、`?` 和字符类都遵循目录边界,
|
||||
并且仅在单个路径组件内匹配,而 `**` 是唯一可以跨越目录分隔符匹配的模式。
|
||||
|
||||
有四种不同类型的模式:
|
||||
|
||||
FILE
|
||||
选择任何名为 FILE 的文件。您可以使用任何 globbing
|
||||
字符,如 * 和 ?,以及字符类,如 [a-z]。
|
||||
选择任何名为 FILE 的文件。
|
||||
此模式仅适用于文件,不适用于目录。
|
||||
|
||||
DIR/
|
||||
选择任何名为 DIR 的目录及其内部的所有内容。
|
||||
您可以使用任何 globbing 字符,如 * 和 ?。
|
||||
此模式仅适用于目录,不适用于文件。
|
||||
|
||||
/PATH/FILE
|
||||
选择完全指定的 file path。您可以使用任何
|
||||
globbing 字符,如 * 和 ?,但它们绝不匹配
|
||||
目录斜杠。
|
||||
此模式仅适用于文件,不适用于目录。
|
||||
选择指定的确切文件路径。此模式仅适用于文件,不适用于目录。
|
||||
|
||||
/PATH/DIR/
|
||||
选择完全指定的 directory path 及其内部的所有内容。
|
||||
您可以使用任何 globbing 字符,如 * 和 ?,但
|
||||
它们绝不匹配目录斜杠。
|
||||
此模式仅适用于目录,不适用于文件。
|
||||
选择指定的确切目录路径及其内部的所有内容。此模式仅适用于目录,
|
||||
不适用于文件。
|
||||
|
||||
当您指定以 / 开头的绝对路径时,它应用于阵列**根目录**,
|
||||
而不是本地文件系统根目录。
|
||||
|
|
|
|||
|
|
@ -1701,31 +1701,59 @@ smartctl 2\-parity \-d areca,2/1 /dev/arcmsr0
|
|||
.RE
|
||||
.SH PATTERN
|
||||
Patterns are used to select a subset of files to exclude or include in
|
||||
the process.
|
||||
the process. Globbing characters can be used to match files and paths
|
||||
in a flexible way.
|
||||
.PP
|
||||
The question mark \`?\` matches any single character except the directory
|
||||
separator. This makes it useful for matching filenames with variable
|
||||
characters while keeping the pattern confined to a single directory level.
|
||||
.PP
|
||||
The single star \`*\` matches any sequence of characters, but like the
|
||||
question mark, it never crosses directory boundaries. It stops at the
|
||||
forward slash, making it suitable for matching within a single path
|
||||
component. This is the standard wildcard behavior familiar from shell
|
||||
globbing.
|
||||
.PP
|
||||
The double star \`**\` is more powerful, it matches any sequence of
|
||||
characters including directory separators. This allows patterns to match
|
||||
across multiple directory levels. When \`**\` appears embedded directly in
|
||||
a pattern, it can match zero or more characters including slashes between
|
||||
the surrounding literal text.
|
||||
.PP
|
||||
The most important use of \`**\` is in the special form \`/**/\`. This matches
|
||||
zero or more complete directory levels, making it possible to match files
|
||||
at any depth in a directory tree without knowing the exact path structure.
|
||||
For example, the pattern \`src/**/main.js\` matches \`src/main.js\` (skipping
|
||||
zero directories), \`src/ui/main.js\` (skipping one directory), and
|
||||
\`src/ui/components/main.js\` (skipping two directories).
|
||||
.PP
|
||||
Character classes using square brackets match a single character from a
|
||||
specified set or range. Like the other single character patterns, they do
|
||||
not match directory separators. Classes support ranges and negation using
|
||||
an exclamation mark.
|
||||
.PP
|
||||
The fundamental distinction to remember is that \`*\`, \`?\`, and character
|
||||
classes all respect directory boundaries and only match within a single path
|
||||
component, while \`**\` is the only pattern that can match across directory
|
||||
separators.
|
||||
.PP
|
||||
There are four different types of patterns:
|
||||
.TP
|
||||
.B FILE
|
||||
Selects any file named FILE. You can use any globbing
|
||||
characters like * and ?, and character classes like [a\-z].
|
||||
Selects any file named FILE.
|
||||
This pattern applies only to files, not directories.
|
||||
.TP
|
||||
.B DIR/
|
||||
Selects any directory named DIR and everything inside.
|
||||
You can use any globbing characters like * and ?.
|
||||
This pattern applies only to directories, not files.
|
||||
.TP
|
||||
.B /PATH/FILE
|
||||
Selects the exact specified file path. You can use any
|
||||
globbing characters like * and ?, but they never match a
|
||||
directory slash.
|
||||
This pattern applies only to files, not directories.
|
||||
Selects the exact specified file path. This pattern applies
|
||||
only to files, not directories.
|
||||
.TP
|
||||
.B /PATH/DIR/
|
||||
Selects the exact specified directory path and everything
|
||||
inside. You can use any globbing characters like * and ?, but
|
||||
they never match a directory slash.
|
||||
This pattern applies only to directories, not files.
|
||||
inside. This pattern applies only to directories, not files.
|
||||
.PP
|
||||
When you specify an absolute path starting with /, it is applied at
|
||||
the array root directory, not the local file system root directory.
|
||||
|
|
|
|||
|
|
@ -1328,31 +1328,59 @@ Configuration
|
|||
|
||||
Pattern
|
||||
Patterns are used to select a subset of files to exclude or include in
|
||||
the process.
|
||||
the process. Globbing characters can be used to match files and paths
|
||||
in a flexible way.
|
||||
|
||||
The question mark `?` matches any single character except the directory
|
||||
separator. This makes it useful for matching filenames with variable
|
||||
characters while keeping the pattern confined to a single directory level.
|
||||
|
||||
The single star `*` matches any sequence of characters, but like the
|
||||
question mark, it never crosses directory boundaries. It stops at the
|
||||
forward slash, making it suitable for matching within a single path
|
||||
component. This is the standard wildcard behavior familiar from shell
|
||||
globbing.
|
||||
|
||||
The double star `**` is more powerful, it matches any sequence of
|
||||
characters including directory separators. This allows patterns to match
|
||||
across multiple directory levels. When `**` appears embedded directly in
|
||||
a pattern, it can match zero or more characters including slashes between
|
||||
the surrounding literal text.
|
||||
|
||||
The most important use of `**` is in the special form `/**/`. This matches
|
||||
zero or more complete directory levels, making it possible to match files
|
||||
at any depth in a directory tree without knowing the exact path structure.
|
||||
For example, the pattern `src/**/main.js` matches `src/main.js` (skipping
|
||||
zero directories), `src/ui/main.js` (skipping one directory), and
|
||||
`src/ui/components/main.js` (skipping two directories).
|
||||
|
||||
Character classes using square brackets match a single character from a
|
||||
specified set or range. Like the other single character patterns, they do
|
||||
not match directory separators. Classes support ranges and negation using
|
||||
an exclamation mark.
|
||||
|
||||
The fundamental distinction to remember is that `*`, `?`, and character
|
||||
classes all respect directory boundaries and only match within a single path
|
||||
component, while `**` is the only pattern that can match across directory
|
||||
separators.
|
||||
|
||||
There are four different types of patterns:
|
||||
|
||||
=FILE
|
||||
Selects any file named FILE. You can use any globbing
|
||||
characters like * and ?, and character classes like [a-z].
|
||||
Selects any file named FILE.
|
||||
This pattern applies only to files, not directories.
|
||||
|
||||
=DIR/
|
||||
Selects any directory named DIR and everything inside.
|
||||
You can use any globbing characters like * and ?.
|
||||
This pattern applies only to directories, not files.
|
||||
|
||||
=/PATH/FILE
|
||||
Selects the exact specified file path. You can use any
|
||||
globbing characters like * and ?, but they never match a
|
||||
directory slash.
|
||||
This pattern applies only to files, not directories.
|
||||
Selects the exact specified file path. This pattern applies
|
||||
only to files, not directories.
|
||||
|
||||
=/PATH/DIR/
|
||||
Selects the exact specified directory path and everything
|
||||
inside. You can use any globbing characters like * and ?, but
|
||||
they never match a directory slash.
|
||||
This pattern applies only to directories, not files.
|
||||
inside. This pattern applies only to directories, not files.
|
||||
|
||||
When you specify an absolute path starting with /, it is applied at
|
||||
the array root directory, not the local file system root directory.
|
||||
|
|
|
|||
|
|
@ -1427,31 +1427,59 @@ An example of a typical configuration for Windows is:
|
|||
=========
|
||||
|
||||
Patterns are used to select a subset of files to exclude or include in
|
||||
the process.
|
||||
the process. Globbing characters can be used to match files and paths
|
||||
in a flexible way.
|
||||
|
||||
The question mark `?` matches any single character except the directory
|
||||
separator. This makes it useful for matching filenames with variable
|
||||
characters while keeping the pattern confined to a single directory level.
|
||||
|
||||
The single star `*` matches any sequence of characters, but like the
|
||||
question mark, it never crosses directory boundaries. It stops at the
|
||||
forward slash, making it suitable for matching within a single path
|
||||
component. This is the standard wildcard behavior familiar from shell
|
||||
globbing.
|
||||
|
||||
The double star `**` is more powerful, it matches any sequence of
|
||||
characters including directory separators. This allows patterns to match
|
||||
across multiple directory levels. When `**` appears embedded directly in
|
||||
a pattern, it can match zero or more characters including slashes between
|
||||
the surrounding literal text.
|
||||
|
||||
The most important use of `**` is in the special form `/**/`. This matches
|
||||
zero or more complete directory levels, making it possible to match files
|
||||
at any depth in a directory tree without knowing the exact path structure.
|
||||
For example, the pattern `src/**/main.js` matches `src/main.js` (skipping
|
||||
zero directories), `src/ui/main.js` (skipping one directory), and
|
||||
`src/ui/components/main.js` (skipping two directories).
|
||||
|
||||
Character classes using square brackets match a single character from a
|
||||
specified set or range. Like the other single character patterns, they do
|
||||
not match directory separators. Classes support ranges and negation using
|
||||
an exclamation mark.
|
||||
|
||||
The fundamental distinction to remember is that `*`, `?`, and character
|
||||
classes all respect directory boundaries and only match within a single path
|
||||
component, while `**` is the only pattern that can match across directory
|
||||
separators.
|
||||
|
||||
There are four different types of patterns:
|
||||
|
||||
FILE
|
||||
Selects any file named FILE. You can use any globbing
|
||||
characters like * and ?, and character classes like [a-z].
|
||||
Selects any file named FILE.
|
||||
This pattern applies only to files, not directories.
|
||||
|
||||
DIR/
|
||||
Selects any directory named DIR and everything inside.
|
||||
You can use any globbing characters like * and ?.
|
||||
This pattern applies only to directories, not files.
|
||||
|
||||
/PATH/FILE
|
||||
Selects the exact specified file path. You can use any
|
||||
globbing characters like * and ?, but they never match a
|
||||
directory slash.
|
||||
This pattern applies only to files, not directories.
|
||||
Selects the exact specified file path. This pattern applies
|
||||
only to files, not directories.
|
||||
|
||||
/PATH/DIR/
|
||||
Selects the exact specified directory path and everything
|
||||
inside. You can use any globbing characters like * and ?, but
|
||||
they never match a directory slash.
|
||||
This pattern applies only to directories, not files.
|
||||
inside. This pattern applies only to directories, not files.
|
||||
|
||||
When you specify an absolute path starting with /, it is applied at
|
||||
the array root directory, not the local file system root directory.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue