1
#!/bin/bash

bonus=0

read -p "Please enter your commission amount(enter a integer value only): " comm

if [$comm -le 200]; then 
    echo "No bonus applicable"
elif [$comm -le 300]; then
    bonus=50
    echo "The bonus applicable is $bonus dollars"
else
    bonus=100
    echo "The bonus applicable is $bonus dollars"
fi

exit 0

Whenever I run my codes and reach the second line of the code where I include my commission input, it will state that [199: command not found] and 199 is the integer that I decided to input to review my codes.

I seek anyone's kind assistance please.

Arkadiusz Drabczyk
  • 25,049
  • 5
  • 53
  • 68
Sabrina
  • 11
  • 1
  • Also: [Brackets in if condition: why am I getting syntax errors without whitespace?](https://unix.stackexchange.com/questions/134472/brackets-in-if-condition-why-am-i-getting-syntax-errors-without-whitespace) – fra-san Sep 29 '20 at 17:39

1 Answers1

2

You're missing a whitespace after [ and before ]. It should be:

if [ $comm -le 200 ]; then

and:

elif [ $comm -le 300 ]; then

Additionally, consider using Shellcheck and fix all reported warnings.

Arkadiusz Drabczyk
  • 25,049
  • 5
  • 53
  • 68