diff --git a/src/rhcsa.md b/src/rhcsa.md index 8e60786..e9f696a 100644 --- a/src/rhcsa.md +++ b/src/rhcsa.md @@ -357,3 +357,34 @@ else echo "The file '$user_file' does not exist." fi ``` + +### for loop +```bash +#!/bin/bash + +for i in 1..10; do + echo $i +done +``` + +### while loop +```bash +#!/bin/bash + +i=1 +while [ $i -le 10 ]; do + echo $i + i=$((i+1)) +done +``` + +### until loop +```bash +#!/bin/bash + +i=1 +until [ $i -gt 10 ]; do + echo $i + i=$((i+1)) +done +``` \ No newline at end of file