#!/bin/bash #Copyright Kris Occhipinti 2018 #http://filmsbykris.com #license GPLv3 - https://www.gnu.org/licenses/gpl.txt l=$(ls *.jpg) tmp_i="" i="" viewer="feh" clear echo "$l" function prompt(){ clear output="$(echo "$l"|grep -i "$i")" count="$(echo "$l"|grep -i "$i"|wc -l)" echo "$count results for $i" echo "====================================" echo "$output" } while true; do read -rsn1 input i+=$input prompt if [ "$output" == "" ] then echo "No Entries Found for ${i}..." echo "Clearing list" i="$tmp_i"; sleep 1 prompt elif [ $count -eq 1 ] then clear echo "$output is found" $viewer "$output" i="" prompt #break fi tmp_i="$i" done