Write a shell program to test whether a given number is even
or odd?

Answer Posted / kushal

echo 10|awk '{ if($0 % 2 == 0) print "Even Number"; else
print"Odd Number"}'

tested and certified one liner answer

Is This Answer Correct ?    28 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about login shell?

637


What does path stand for?

640


i have 2 tables 4 colums table 1 respective values a1 6, a2 8,a3 9,a4 14 & table 2 respective values a1 6, a2 8, a3 9, a4 12. if compare 2 tables 3 colums values same then 4th column values 1)Qes diff >5 then (5 * diff value ) 2)Qes diff <5 the 5 3)Qes diff 5 then 5 print respective values..

1794


What is @echo off?

571


Write a script to print the first 10 elements of fibonacci series.

1772






Can you write a script to portray how set –x works?

556


How do you find out What is your shell?

592


How to use arguments in a script?

587


How do we delete all blank lines in a file?

579


What does $@ mean in shell?

594


Explore about environment variables?

599


what is tickets $ what low,medium,high priorite pls define time also

1723


Why should we use shell scripts?

594


How will you connect to a database server from linux?

557


How will you print the login names of all users on a system?

577