Ask user to show lines (cl)

This commit is contained in:
dmarakom6 2021-06-28 13:49:55 +03:00
parent 23f9a6f6e4
commit c453b82bc3

View file

@ -5,12 +5,26 @@ Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
out="$(grep $regex $DEFAULT_PATH/$notename | wc -l)"
if [ -f $DEFAULT_PATH/$notename ]; then
out="$(grep $regex $DEFAULT_PATH/$notename | wc -l)"
if [ $out -eq 1 ]; then
echo "Compressed $out line of grep output."
elif [ $out -gt 1 ]; then
echo "Compressed $out lines of grep output."
echo -n "Show lines?(Y/N): " && read show
case $show in
yes | y | Y | YES | Yes )
grep -n $regex $DEFAULT_PATH/$notename
;;
esac
else
echo "No matching lines found."
fi
if [ $out -eq 1 ]; then
echo "Compressed $out line of grep output."
elif [ $out -gt 1 ]; then
echo "Compressed $out lines of grep output."
else
echo "No matching files found."
fi
echo "No such file."
return 0
fi