Bash shell script to check a given number is positive or negative
codeaft.sh
#!/bin/bashecho"———————————————————————————————————————————"echo"Script to check a given number is +ve or -ve "echo"———————————————————————————————————————————"echo"Enter the number \c";read a
b=0
if[$a-gt$b];then
echo"Entered number is positive"elif[$a-eq$b];then
echo"Entered number is zero"else
echo"Entered number is negative"fi
echo"———————————————————————————————————————————"
Output
codeaft@codeaft:~$ bash codeaft.sh
———————————————————————————————————————————
Script to check a given number is +ve or -ve
———————————————————————————————————————————
Enter the number -50
Entered number is negative
———————————————————————————————————————————
codeaft@codeaft:~$ sh codeaft.sh
———————————————————————————————————————————
Script to check a given number is +ve or -ve
———————————————————————————————————————————
Enter the number 0
Entered number is zero
———————————————————————————————————————————
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.