Skip to content

Commit 25d82ec

Browse files
improved comments
1 parent e225e29 commit 25d82ec

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

posix-arrays.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# for indexed arrays, $_i_[arr_name]_h_index variable holds the highest index in the array if it's known
1313

1414

15-
# unsets all variables used to store the array
15+
# unsets all variables used to store an indexed array
1616
# 1 - array name
1717
unset_i_arr() {
1818
___me="unset_i_arr"
@@ -24,6 +24,7 @@ unset_i_arr() {
2424
eval "_i_${_arr_name}_sorted_flag=0"
2525
}
2626

27+
# backend function
2728
# unsets all variables of an indexed array
2829
# 1 - array name
2930
do_unset_i_arr() {
@@ -310,8 +311,7 @@ get_i_arr_max_index() {
310311
fi
311312
fi
312313

313-
eval "_i_${_arr_name}_h_index"='$_h_index'"
314-
$_out_var"='$_h_index'
314+
eval "_i_${_arr_name}_h_index"='$_h_index' "$_out_var"='$_h_index'
315315

316316
return 0
317317
}
@@ -404,7 +404,7 @@ get_i_arr_val() {
404404
}
405405

406406

407-
# unsets all variables used to store the array
407+
# unsets all variables used to store an associative array
408408
# 1 - array name
409409
unset_a_arr() {
410410
___me="get_a_arr_val"
@@ -417,6 +417,7 @@ unset_a_arr() {
417417
eval "_a_${_arr_name}_sorted_flag=0"
418418
}
419419

420+
# backend function
420421
# unsets all variables of an associative array
421422
# 1 - array name
422423
do_unset_a_arr() {
@@ -613,6 +614,7 @@ get_a_arr_val() {
613614
eval "$_out_var"='${___val#"${_el_set_flag}"}'
614615
}
615616

617+
## Backend functions
616618

617619
check_strings() {
618620
case "$1$2$3" in *[!A-Za-z0-9_]* )
@@ -627,6 +629,7 @@ check_index() { case "$_index" in *[!0-9]* ) echo "$___me: Error: '$_index' is n
627629
check_pair() { case "$___pair" in *=* ) ;; * ) echo "$___me: Error: '$___pair' is not a 'key=value' pair." >&2; return 1; esac; }
628630
wrongargs() { echo "$___me: Error: '$*': wrong number of arguments '$#'." >&2; }
629631

632+
## Constants
630633

631634
___newline="
632635
"

0 commit comments

Comments
 (0)