Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Glob problem



Hello Zsh masters,

I am simply trying to list all matches for a specified pattern in an array of directory paths, the $path array for example. Here is my attempt. Where am I going wrong?

pattern=git*
for entry in $path
do
    # Print all files in the path that match the pattern. 
    print $entry/$pattern
done

Expected/Desired Output:
------------------------
/opt/local/bin/git
/opt/local/bin/git-credential-osxkeychain
/opt/local/bin/git-cvsserver
/opt/local/bin/git-receive-pack
/opt/local/bin/git-shell
/opt/local/bin/git-upload-archive
/opt/local/bin/git-upload-pack
/opt/local/bin/gitk
/usr/bin/git
/usr/bin/git-cvsserver
/usr/bin/git-receive-pack
/usr/bin/git-shell
/usr/bin/git-upload-archive
/usr/bin/git-upload-pack

Actual Output:
-------------------
/opt/local/bin/git*
/opt/local/sbin/git*
/opt/local/bin/git*
/opt/local/sbin/git*
/usr/bin/git*
/bin/git*
/usr/sbin/git*
/sbin/git*
/usr/local/bin/git*
/usr/local/MacGPG2/bin/git*
/Users/brent/bin/git*
/Users/brent/bin/git*


Messages sorted by: Reverse Date, Date, Thread, Author