Skip to content

Instantly share code, notes, and snippets.

@jozko
Created August 13, 2019 13:31
Show Gist options
  • Save jozko/5c74f3dde788ad75cf747f2a3dd6964a to your computer and use it in GitHub Desktop.
Save jozko/5c74f3dde788ad75cf747f2a3dd6964a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Interpolation to {} is not possible in bash
# see https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html#Shell-Expansions
# So using a counter and an array may come handy sometimes
MAX_COUNT=6
arr=()
while true; do
((counter++))
arr="$arr $counter"
if [[ "$counter" -eq ${MAX_COUNT} ]]; then
break
fi
done
echo $arr
for e in $arr
do
echo $e
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment