Skip to content

Instantly share code, notes, and snippets.

@richo
Created September 14, 2012 04:53
Show Gist options
  • Save richo/3719874 to your computer and use it in GitHub Desktop.
Save richo/3719874 to your computer and use it in GitHub Desktop.
#!/bin/sh
files=no
dirs=no
ack=no
while getopts "fda" opt; do
case $opt in
f)
files=yes
break;;
d)
dirs=yes
break;;
a)
dirs=yes
break;;
esac
done
if [ "$files" == "yes" ]; then
echo --- [ Find Directories ] -------
find . -type d -name "*$1*"
fi
if [ "$dirs" == "yes" ]; then
echo --- [ Find Files ] -------------
find . -type f -name "*$1*"
fi
if [ "$ack" == "yes" ]; then
echo --- [ ACK Files ] --------------
ack $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment