Created
January 27, 2017 02:38
-
-
Save spikegrobstein/6a4152f8ad5711be550db0ad4e5a343c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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