Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2017 07:03
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 anonymous/993b6e1c9c0b7e6e1d69bb0fd8eae7e4 to your computer and use it in GitHub Desktop.
Save anonymous/993b6e1c9c0b7e6e1d69bb0fd8eae7e4 to your computer and use it in GitHub Desktop.
#!/bin/bash
case $1 in
m) LISTGEN="mpc search any";
HANDLER="mpc insert";
;;
f) LISTGEN="find ~/* -iname \*\"\$QUERY\"\*";
HANDLER="exo-open";
;;
esac
until [[ $QUERY_RESULT != "" ]]; do
read QUERY
if [[ $QUERY == "" ]]
then exit
fi
QUERY_RESULT=$($LISTGEN "$QUERY" 2>/dev/null)
done
echo "$QUERY_RESULT" | cat -n
read QUERY_CHOICE
$HANDLER "$(echo "$QUERY_RESULT" | awk NR==$QUERY_CHOICE)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment