#!/bin/bash
Echo “Enter a number”
Read $number
If [$number ] ; then
Echo “Your number is divisible by 5”
Else
Echo “Your number is not divisible by 5”
fi
the if [$number] statement is what I don't know how to set up
feedback
|
|
No bc needed as long as it's integer math (you'll need bc for floating point though): In bash, the (( )) operator works like expr. As others have pointed out the operation you want is modulo (%).
| ||||
|
feedback
|
|
You can use a simpler syntax in Bash than some of the others shown here:
| ||||
feedback
|
|
How about using the
| |||||||||
feedback
|
|
Nagul's answer is great, but just fyi, the operation you want is modulus (or modulo) and the operator is generally | |||
|
feedback
|