Skip to content

Instantly share code, notes, and snippets.

@junegunn
Created January 5, 2015 02:11
Show Gist options
  • Save junegunn/42d2285580c9890e0fd6 to your computer and use it in GitHub Desktop.
Save junegunn/42d2285580c9890e0fd6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
output=$(fzf --print-query --multi)
mapfile -t lines <<< "$output"
query="${lines[0]}"
matches=(${lines[@]:1})
echo "Query: $query"
if [ ${#matches[@]} -eq 0 ]; then
echo "- No result"
else
echo "Results:"
for match in "${matches[@]}"; do
echo "- $match"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment