Basic while-loop in Bash

PHOTO EMBED

Sun Mar 28 2021 09:42:01 GMT+0000 (Coordinated Universal Time)

Saved by @FlorianC #bash

#!/bin/bash

n=1 # in Bash, there are no spaces allowed when declaring variables
while [ $n -le 5]; do # the "[ condition ]"-syntax is equivalent to the "test" command
  echo "Iteration number $n"
  ((n+=1)) # in Bash, we use double parentheses to perform arithmetic operations on variables
done
content_copyCOPY