-2

Simple script. confused by what is expected in line 2. New to this but feeling like I'm spinning wheels trying to get pseudo code to run.

#!/bin/bash
if [ $a -gt 10 ]
then
  echo "Greater than 10, subtracting 1"
  let a -=1
else
  echo "Less than or equal to 10"
fi
S.I.J
  • 979
  • 1
  • 10
  • 22
tyro1218
  • 1
  • 1

1 Answers1

-1

Something like this? I think it was the semicolon you were missing on the if statement. Also, we're assuming $a is defined.

#!/bin/bash
if [ $a -gt 10 ]; then 
  echo "Greater than 10, subtracting 1" 
  let a -=1 
else 
  echo "Less than or equal to 10";
fi
dtc
  • 1,774
  • 2
  • 21
  • 44
  • The original newlines have been re-enabled, `then` was on its own line originally, so it wasn't this, sorry. – Gem Taylor Feb 11 '20 at 15:39