Write a shell program to test whether a given number is even
or odd?
Answer Posted / rk
echo"enter number"
read n
set r=($n%2)
if(r eq-0)
then
echo "even number:$n"
else
echo "odd number:$n"
fi
| Is This Answer Correct ? | 24 Yes | 16 No |
Post New Answer View All Answers
What is in a script?
Print the 10th line without using tail and head command.
What is the lifespan of a variable inside a shell script?
Give some situations where typing error can destroy a program?
How to print all array elements and their respective indexes?
What is the use of .sh file?
What is the use of a shebang line?
How to set an array in linux?
I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?
Explain about the exit command?
Is shell scripting a programming language?
State the advantages of shell scripting?
How to find all the files modified in less than 3 days and save the record in a text file?
What is an sh file?
Is shell a scripting language?