#!/bin/ksh
#prompt the user to enter an input
print -n "enter the number of children you have :"
read numberofchildren
if ( (( numberofchildren>0 )) &&((numberofchildren<=1)) ); then #the space after the ( and before the ) is important
print "you have one children"
else
print "you have more than one children"
fi
Showing posts with label KornShell. Show all posts
Showing posts with label KornShell. Show all posts
Saturday, May 30, 2020
If statement in Kornshell
#!/bin/ksh
#prompt the user to enter a number
print -n "Enter your age: "
read age
if ((age >= 18))
then
print "Vote"
fi
#operators are ==,!=,>,<,>=,<=
#prompt the user to enter a number
print -n "Enter your age: "
read age
if ((age >= 18))
then
print "Vote"
fi
#operators are ==,!=,>,<,>=,<=
Sunday, April 19, 2020
Subscribe to:
Posts (Atom)