Greetings all,
How do you pause the screen in a
while read loop? Here is a snippet of code from another post yesterday. I've gotten the real script pretty well developed, but then thought my screen output was rather long and thought I'd allow a pause to give the user time to read it vice scrolling back and forth. But, I can't get an
echo -n nor a
read -p to stop. Is a pause impossible inside of this kind of while construct? Or, perhaps, I am facing the possibility that my bash shell is outdated as I found out recently it does not have some of the shopt constructs. I also tried to setup a pause function and call it from within the loop. Should I format my
while read statement differently?
Code:
#!/bin/bash
while read STRING
do
echo "$STRING" >> certfile1.out
echo "$STRING" # Echoing for testing and watching for END string.
if [ "$STRING" = "-----END CERTIFICATE-----" ]; then
echo END found
echo -n "Press any key to continue: "
read KEY
#DID NOT WORK# read -p "Press any key to continue: "
fi
done < inputcertfile.crt