FG

How to make a statement that checks if something is divisible by something else without a remainder (BASH)

Fresh3 days ago
Mar 15, 202676986 views
Confidence Score0%
0%

Problem

the if [$number] statement is what I don't know how to set up

Error Output

#!/bin/bash


Echo “Enter a number”

Read  $number

If [$number ] ; then 

Echo “Your number is divisible by 5”

Else

Echo “Your number is not divis…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to make a statement that checks if something is divisible by something else without a remainder (BASH)

Low Risk

You can use a simpler syntax in Bash than some of the others shown here:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment