Skip to content

Instantly share code, notes, and snippets.

@spikegrobstein
Created January 27, 2017 02:38
Show Gist options
  • Save spikegrobstein/6a4152f8ad5711be550db0ad4e5a343c to your computer and use it in GitHub Desktop.
Save spikegrobstein/6a4152f8ad5711be550db0ad4e5a343c to your computer and use it in GitHub Desktop.
#! /bin/bash -
run_loop() {
local list=()
for item in $( seq 5 10 ); do
list+=("$item")
done
echo "List has ${#list[@]} items"
}
run_local_loop() {
local i
local list=()
for item in $( seq 5 10 ); do
list+=("$item")
done
echo "List has ${#list[@]} items"
}
item="foo"
echo "item -> $item"
run_loop
echo "item -> $item"
item="bar"
run_local_loop
echo "item -> $item"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment