Skip to content

Commit cb73a69

Browse files
rousonzbeekman
authored andcommitted
Edited stack.sh for execution with set -o pipefail
1 parent 045794c commit cb73a69

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

prerequisites/stack.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function stack_pop
154154
# Usage: stack_print name
155155
#
156156
# Modification for use with bash3boilerplate:
157-
# replaced "let _i=${_i}-1" with "(( _i=${_i}-1 ))" to facilitate execution with "set -o nounset"
157+
# replaced "let _i=${_i}-1" with "(( _i=${_i}-1 )) || true" to support execution with "set -o nounset"
158158

159159
function stack_print
160160
{
@@ -171,10 +171,11 @@ function stack_print
171171

172172
while (( $_i > 0 ))
173173
do
174-
(( _i=${_i}-1 ))
174+
(( _i=${_i}-1 )) || true
175175
eval 'e=$'"{_stack_$1[$_i]}"
176176
tmp="$tmp $e"
177177
done
178+
178179
echo "(" $tmp ")"
179180
}
180181

0 commit comments

Comments
 (0)