if ESC from fzf and no deck chosen, then exit

This commit is contained in:
Bryan Jenks 2020-04-20 16:41:38 -07:00
parent 4e49db61b2
commit 9748307404
1 changed files with 3 additions and 0 deletions

3
flash
View File

@ -104,6 +104,9 @@ fi
# Show pretty FZF preview of decks using BAT # Show pretty FZF preview of decks using BAT
DECK="$(find -maxdepth 999 -iname "*.csv" | fzf --preview='bat --theme="Solarized (dark)" --style=numbers --color=always {} | head -500')" DECK="$(find -maxdepth 999 -iname "*.csv" | fzf --preview='bat --theme="Solarized (dark)" --style=numbers --color=always {} | head -500')"
if [ -z $DECK ]; then # If Variable String Length is 0
exit
fi
main(){ main(){
IFS=$':'; read -a q <<<$(sort "$DECK" -n --field-separator=: --key=4 | head | shuf -n 1) IFS=$':'; read -a q <<<$(sort "$DECK" -n --field-separator=: --key=4 | head | shuf -n 1)