30 Apr 21:44
Re: [1003.1(2008)/Issue 7 0000247]: Add nullglob (null globbing) support to shell's "set" and glob()
Subject: Re: [1003.1(2008)/Issue 7 0000247]: Add nullglob (null globbing) support to shell's "set" and glob() -------- > Many shells have a way of doing this, but there is no *standard* way to do > it. Doing this in a shell is often called "null globbing" > Null globbing fixes this by replacing an unmatched pattern with nothing at > all. In bash you can enable nullglob with "shopt -s nullglob". In zsh, you > can use "setopt NULL_GLOB" for the same result. Then, "for" loops on glob > patterns will work correctly if nothing matches the glob pattern. > In ksh93, you can do this on a per pattern basis with ~(N) in front of the pattern, for exampe for i in ~(N)*.c do xxx done which will skip the loop of there are no files ending with .c. David Korn dgk@...
RSS Feed