Bash globbing files only?
Cameron Simpson
cs at zip.com.au
Wed Jan 31 23:54:24 UTC 2007
On 31Jan2007 08:47, Daniel Qarras <dqarras at yahoo.com> wrote:
| > A POSIX shell requires that the test command supports this:
| >
| > -h file
| > True if file exists and is a symbolic link.
| > -L file
| > True if file exists and is a symbolic link.
|
| Thanks, I already saw those but initially they did not work for
| directories. That was because I had
|
| dirs=[^.]*/
|
| that would expand, e.g:
|
| foo/
| bar/
|
| and the trailing slash caused -L test to fail.
Indeed, because it forces a test to be _not_ on the symlink but on what
is on the far side of it.
BTW, if you've been following this thread you should know that:
[^.]*/
is better written:
*/
which means _exactly_ the same thing.
Of course, you realise that you may not need to test for -d at all
because */ will only return directories (or things pointing at them).
(Except when there are no directories at all - the it returns "*/"
unchanged and you just need to test for existence.)
Cheers,
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
Haven't been there. Don't want to go. Don't need another t-shirt!
- Lisa Varner <varner at freenet.columbus.oh.us>
More information about the fedora-list
mailing list