So, I am new to shell scripting and have a few problems.
I know how to read from standard input but I do not know how to really compare it to say, a character. I am trying to compare it to a character and anything exceeding just a character, the user will get an output message, but the program goes on.
I tried using test with regular expressions after taking an input like this.
read input
while test $input != q || test -z $input
do
if test $input = n
then
...
I also want my program to move on if the input just presses enter, but I get two error messages on the while statement and the if statement saying unary operator expected.
Each time you run test you're creating a new process and waiting for it to quit. [ ] are usually shell built-ins these days, so no new process is needed -- meaning, hundreds of times faster.