Last active
April 11, 2017 14:14
-
-
Save andras-tim/909aa427343aede851bc6622cf91d628 to your computer and use it in GitHub Desktop.
code snipet for comment on http://stackoverflow.com/a/43346098/1108919
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eufo pipefail | |
shopt -s extglob | |
patterns='' | |
for pattern in "$@"; do | |
patterns+="${pattern}|" | |
done | |
while read -r i; do | |
if [[ "$i" == @(${patterns%|}) ]]; then | |
echo "$i" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment