Is the practices of. * to include. and also. specified in LSB or POSIX or a few other requirements?

Is the actions of .* to include . and also .. specified in LSB or POSIX or a few other requirements?

0
2019-05-05 20:04:08
Source Share
Answers: 3

Quoting from the Single Unix specification version 2, volume ”Commands & Utilities", §2.13.3 :

If a filename starts with a duration (.) the duration have to be clearly matched by utilizing a duration as the first personality of the pattern or quickly adhering to a lower personality. (...) It is undefined whether a specific duration in a brace expression matching checklist, such as [.abc] can match a top duration in a filename.

There is no exception that would certainly make the 2nd duration in .., or the vacant string adhering to the only duration in ., not matched by the wildcard in .*. Consequently the standard claims that .* matches . and also .. , aggravating though it might be.

The flow over defines the actions of the shell (sh command). The area on the glob C collection function refererences this flow.

The language is specifically the very same in version 3, additionally called POSIX :2001 and also IEEE 1003.1 - 2001, which is what the majority of existing systems implement.

Dashboard, bash and also ksh93 follow POSIX. Pdksh and also zsh (also under emulate sh) do not.

In ksh, you can make .* miss . and also .. by establishing FIGNORE='.?(.)', yet this has the negative effects of making * include dot files. Or you can set FIGNORE='.*', yet after that .* does not match anything.

In bash, you can make .* miss . and also .. by establishing GLOBIGNORE='.:..', yet this has the negative effects of making * include dot files. Or you can set GLOBIGNORE='.*', yet after that .* does not match anything.

0
2019-05-08 18:53:39
Source

Probably you suggest the capability in celebration development concerning globignore. By default the celebration development suit. and also. yet reviewing the male :

The  GLOBIGNORE shell variable may be used to restrict the set of file names matching
   a pattern.  If GLOBIGNORE is set, each matching file name that also  matches  one  of
   the patterns in GLOBIGNORE is removed from the list of matches.  The file names ``.''
   and ``..''  are always ignored when GLOBIGNORE is set and not null.  However, setting
   GLOBIGNORE  to  a non-null value has the effect of enabling the dotglob shell option,
   so all other file names beginning with a ``.''  will match.  To get the old  behavior
   of  ignoring  file  names beginning with a ``.'', make ``.*''  one of the patterns in
   GLOBIGNORE.  The dotglob option is disabled when GLOBIGNORE is unset.

You can set the variable GLOBIGNORE=.:.. so when you tipe something similar to this :

rm -r * .*

you are getting rid of just the existing directory site. The POSIX standard just define that. is the existing directory site and also. in the moms and dad of the existing directory site. The unique definition of. * is analyzed by celebration or various other coverings (or programs like grep).

0
2019-05-08 10:42:45
Source

The Linux man-page referrals POSIX.2, 3.13.

0
2019-05-08 10:40:45
Source