Skip to content

Instantly share code, notes, and snippets.

@stav
Created May 15, 2016 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stav/c3ad11db66f966107deca917643aee37 to your computer and use it in GitHub Desktop.
Save stav/c3ad11db66f966107deca917643aee37 to your computer and use it in GitHub Desktop.
Find files using a shorter syntax: `f .jpg`
#!/bin/bash
if [ `expr index "$1" "\+"` = 0 ]; then
PATTERN="*$1*"
else
#PATTERN="$1"
PATTERN="${1/+/*}"
fi
if [ -n "$2" ]; then
TARGET="$2"
else
TARGET="."
fi
eval "find $TARGET -name '$PATTERN' 2>/dev/null"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment