All this I have to do through PUTTY. Please give me commandsthat way I can insert these commands into PUTTY.
Create the following script,joker2.sh, and run the test commands above (use joker3.sh insteadof joker.sh). In this example, grep $1 /etc/passwd sets the valueof $? to 0 (true) if the pattern is matched and sets $? to 1(false) if the pattern is not matched. if then acts on the value of$?.
#!/bin/sh
#
if grep $1 /etc/passwd
then
echo“Pattern found – Exiting Now!”
exit 0 else
echo“Pattern not found – Job Over!”
exit1
fi
Answer