Bash globbing files only?

Cameron Simpson cs at zip.com.au
Wed Jan 31 00:39:26 UTC 2007


On 30Jan2007 09:08, Daniel Qarras <dqarras at yahoo.com> wrote:
| PS. A hard headed zsh user would continue to complain that there's no
| way to differ between files and links in bash without find but I won't
| go into that :)

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.

There are two letters for historic reasons. Bash supports both, and so
does zsh.

Of course, if you mean a hardlink, then you're asking a question
that is meaningless.

BTW, I tend to test directorishness like this:

  [ -d foo/. ]

which works for a directory or a symlink that resolves to a directory.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

I am a kind of burr; I shall stick.
        - William Shakespeare, _Measure for Measure_




More information about the users mailing list