Conform to the convention that the name of a private variables should
start with an underscore character. Also there is no need to export
the variable.
-export GSU_NODE_NAME_PATTERN='[a-zA-Z_]'
+_gsu_node_name_pattern='[a-zA-Z_]'
- local tmp="${1%%$GSU_NODE_NAME_PATTERN*}"
+ local tmp="${1%%$_gsu_node_name_pattern*}"
#echo "line: $line_num, root: $root, indent level: $level"
result="$(sed -e "1,${line_num}d;" <<< "$tree" \
#echo "line: $line_num, root: $root, indent level: $level"
result="$(sed -e "1,${line_num}d;" <<< "$tree" \
- | sed -e "/^$TAB\{1,$level\}$GSU_NODE_NAME_PATTERN/,\$d" \
+ | sed -e "/^$TAB\{1,$level\}$_gsu_node_name_pattern/,\$d" \
| sed -e "/^$TAB\{$(($level + 2))\}/d")"
ret="$level"
}
| sed -e "/^$TAB\{$(($level + 2))\}/d")"
ret="$level"
}
{
local tree="$1" TAB=' '
{
local tree="$1" TAB=' '
- result="$(grep "^${TAB}${GSU_NODE_NAME_PATTERN}" <<< "$tree")"
+ result="$(grep "^${TAB}${_gsu_node_name_pattern}" <<< "$tree")"