Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Glob problem
- X-seq: zsh-users 18042
- From: Brent Briggs <brent.briggs@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Glob problem
- Date: Tue, 22 Oct 2013 12:45:48 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=NOggsS1RB6CZI3AIjjixr22rty+NjTtIoZRPQXd8ZbE=; b=A7QJJVJOep2oGlDSKltIJPr0Z0s2jzsI6y+VbYLd7ggqCMEB7zjEvJfjhTqziXiggC 6ar3PWNDcx2Heis2fSU9E5Ay3OZpkfFvsTb6cBSXVs2eyq3IyfgWviTpOSDHynH3TGTr jCSV4Xkxx2tJ4ARvZ4T1ygt6uDLFZwP4vEhealu1ikzl4lA6hEKJDq8VL7jZKGRx9/jp 1F0INjsgqOYuujPl5fOVf9X1dkKarG8ookqvjZtltla8JeOUxntzxgCOLDpx3nbQtKmo vYe59zj0rUOJs5rSSiAiCRjeN7HzJxmq32QgjiV9dxoBvay0opthf7YuVmeYDZDKSUlS WDbw==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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