added an if statement to check whether the inputed short code actually
exists
LINENUMBER=$(cut -f 1 -d ',' -s $CHARFILE \
| grep -wn $INPUT \
| cut -d : -f 1)
LINENUMBER=$(cut -f 1 -d ',' -s $CHARFILE \
| grep -wn $INPUT \
| cut -d : -f 1)
OUTPUT=$(cut -f 2 -d ',' -s $CHARFILE \
| head -$LINENUMBER \
| tail +$LINENUMBER)
OUTPUT=$(cut -f 2 -d ',' -s $CHARFILE \
| head -$LINENUMBER \
| tail +$LINENUMBER)
+ if [[ $(cut -f 1 -d ',' -s $CHARFILE \
+ | grep -wnc $INPUT) == "0" ]]
+ then
+ OUTPUT=""
+ fi
+
# Copy output to clipboard
echo $OUTPUT | xclip -selection clipboard
# Copy output to clipboard
echo $OUTPUT | xclip -selection clipboard