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

Answer Posted / santana20142003

$ echo <number> | nawk '{ if($0 % 2 ==0) print $0 "Even
Number" ;\
else print $0 "Odd Number"}'

Is This Answer Correct ?    24 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to redirect both standard output and standard error to the same location?

641


What is in a script?

573


Is powershell a language?

567


Is shell scripting a language?

588


How to get script name inside a script?

556






Why do we write bin bash in shell scripts?

547


How will you pass and access arguments to a script in linux?

591


c program to display the information of given file similar to givan by the unix or linux command ls -l

1700


What is the conditional statement in shell scripting?

661


What are the four fundamental components of every file system on linux?

1168


What are the different types of variables used in shell script?

557


Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?

1720


What is an sh file?

562


What is subshell?

532


How does path variable work?

550