There are several problems here...
Is this a homework assignment? If it is, please fill out the complete
homework template and refile your request in the
Homework & Coursework Questions forum.
If not, what type of file is
/opt? (The
grep utility isn't intended to work on directories.) If it is a regular file, what is in it?
What does the program
email do on your system when given the operand
id? How does the value of the variables
var1 and
var2 in the environment affect its behavior?
What is in the file
tmp1 when you run your script each of the first three times?
What is the "right output" for each of the 1st three times when you run this script?
What operating system are you using?
What diagnostics did your script produce each of the 1st three times you ran it?