From 3ffea3c144f3db70c9287dac706054769feb8fed Mon Sep 17 00:00:00 2001 From: zleyyij Date: Thu, 30 May 2024 18:22:46 -0600 Subject: [PATCH] vault backup: 2024-05-30 18:22:46 --- IT/Scripting.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/IT/Scripting.md b/IT/Scripting.md index 2d71b90..fe44e4f 100644 --- a/IT/Scripting.md +++ b/IT/Scripting.md @@ -71,6 +71,18 @@ goodbye) esac ``` +## Loops +### For loops +`for` loops are used when you have a finite collection over which you want to iterate, such as a list of files, or a list of server names: +```bash + +THINGS="thingone thingtwo thingthree" +for S in $THINGS; do + echo "Doing something to $S" +done +``` +### While loops + ## Commands | Command | Description | | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |