KSH if statement

Hi guys,

im new to UNIX so bear with me.

would it be possible for me to create an if statement where i can have a key being entered and something happening after that. (bad explanation)

eg. If user enters letter 'q' then
close window or exit puTTy

Thanks in advance

Sure you can. I recommend to start reading something like this:
Linux Shell Scripting Tutorial - A Beginner's handbook
or
BASH Programming - Introduction HOW-TO

Example to start with:

#!/usr/bin/ksh

echo "Enter a q and hit enter:"

read INPUT
if [[ "${INPUT}" == "q" ]]; then
     echo "You made it!"
     exit 0
else
     echo "Close but not correct."
     exit 1
fi

Sometimes it comes more handy to use case/esac.
Start reading the links I posted so you can have a start and ask if you get stuck.
Just in case: Homework or Classroom stuff may only be posted in the special subforum for it. Check the The UNIX and Linux Forums - Forum Rules to see what I mean :wink: