Created
July 4, 2017 07:03
-
-
Save anonymous/993b6e1c9c0b7e6e1d69bb0fd8eae7e4 to your computer and use it in GitHub Desktop.
This file contains 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 | |
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