Get an error when I run just the script by itself. $ bin/bashpp bin/bashpp: line 1768: files[@]: unbound variable This is on AIX 7.1. $ bin/bashpp bin/bashpp: line 1768: files[@]: unbound variable $ bash -x bin/bashpp + set -euo pipefail + exec ++ readlink -f bin/bashpp + bashpp='. .. .gitignore README.md bin circle.yml t test.sh' + bashpp_dir='. .. .gitignore README.md bin circle.yml t test.sh' + BASHINC= + DEFS=() + declare -A DEFS + MACROS=() + declare -A MACROS + output=/dev/stdout + VERBOSE=0 + DEBUG=0 + DEBUG_STATES= + DEBUG_STATES_FLAG=0 + DEBUG_LINENO=0 + ERROR_LINE=1 + ERROR_MAX=10 + BUF_MAX=4096 + FILE_MAX=0 + RET_PROCHR_CONT=1 + RET_PROCHR_PUSHBUF=2 + RET_PROCHR_POPSTATE=4 + RET_PROCHR_SKIP=8 + OUTPUT_LINES=0 + SECONDS=0 + (( BUF_MAX > FILE_MAX )) + BUF_MAX=0 + CR=$'\r' + LF=' ' + CRLF=' ' + TAB=' ' + WHITESPACE=' ' + errors=0 + warnings=0 + lineno=0 + msg_errorline_lock=0 + tty_stdout=0 + tty_stderr=0 + tty_stdin=0 + tty=0 + [[ -t 0 ]] + tty_stdin=1 + tty=1 + [[ -t 1 ]] + tty_stdout=1 + tty=1 + [[ -t 2 ]] + tty_stderr=1 + tty=1 + states=1 + state_names=("eof") + eof=0 + files=() + trap cleanup EXIT + set -E + trap 'stacktrace "$BASH_SOURCE" "$LINENO" "${FUNCNAME:-main}"' ERR + (( BASH_VERSINFO[0] < 4 || ( BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 1 ) )) + (( 0 > 0 )) + (( 0 == 0 )) + set -- /dev/stdin + initialise + local fn= name= exp= x= + state_names=("eof") + local state_names + states=1 + read x x fn ++ declare -F + [[ add_define == process_char_state_* ]] + read x x fn + [[ add_include_dir == process_char_state_* ]] + read x x fn + [[ assoc_arrcpy == process_char_state_* ]] + read x x fn + [[ bashpp_msg == process_char_state_* ]] + read x x fn + [[ callable == process_char_state_* ]] + read x x fn + [[ cleanup == process_char_state_* ]] + read x x fn + [[ debug == process_char_state_* ]] + read x x fn + [[ debug_l == process_char_state_* ]] + read x x fn + [[ debug_state_change == process_char_state_* ]] + read x x fn + [[ define == process_char_state_* ]] + read x x fn + [[ definefn == process_char_state_* ]] + read x x fn + [[ describe_char == process_char_state_* ]] + read x x fn + [[ die == process_char_state_* ]] + read x x fn + [[ err == process_char_state_* ]] + read x x fn + [[ flush_buf == process_char_state_* ]] + read x x fn + [[ freeze_buf == process_char_state_* ]] + read x x fn + [[ getc == process_char_state_* ]] + read x x fn + [[ in_state == process_char_state_* ]] + read x x fn + [[ info == process_char_state_* ]] + read x x fn + [[ info_progress == process_char_state_* ]] + read x x fn + [[ initialise == process_char_state_* ]] + read x x fn + [[ is_define == process_char_state_* ]] + read x x fn + [[ is_macro == process_char_state_* ]] + read x x fn + [[ iter_file == process_char_state_* ]] + read x x fn + [[ iter_files == process_char_state_* ]] + read x x fn + [[ msg == process_char_state_* ]] + read x x fn + [[ msg_errorline == process_char_state_* ]] + read x x fn + [[ msgtype_colour == process_char_state_* ]] + read x x fn + [[ pop_heredoc == process_char_state_* ]] + read x x fn + [[ pop_state == process_char_state_* ]] + read x x fn + [[ process_char == process_char_state_* ]] + read x x fn + [[ process_char_state_apos == process_char_state_* ]] + name=apos + state_names+=($name) + printf -v apos %d 1 + export apos + (( ++states )) + read x x fn + [[ process_char_state_arithmetic == process_char_state_* ]] + name=arithmetic + state_names+=($name) + printf -v arithmetic %d 2 + export arithmetic + (( ++states )) + read x x fn + [[ process_char_state_bracket_c == process_char_state_* ]] + name=bracket_c + state_names+=($name) + printf -v bracket_c %d 3 + export bracket_c + (( ++states )) + read x x fn + [[ process_char_state_bracket_s == process_char_state_* ]] + name=bracket_s + state_names+=($name) + printf -v bracket_s %d 4 + export bracket_s + (( ++states )) + read x x fn + [[ process_char_state_comment == process_char_state_* ]] + name=comment + state_names+=($name) + printf -v comment %d 5 + export comment + (( ++states )) + read x x fn + [[ process_char_state_conditional == process_char_state_* ]] + name=conditional + state_names+=($name) + printf -v conditional %d 6 + export conditional + (( ++states )) + read x x fn + [[ process_char_state_conditional_end == process_char_state_* ]] + name=conditional_end + state_names+=($name) + printf -v conditional_end %d 7 + export conditional_end + (( ++states )) + read x x fn + [[ process_char_state_conditional_operator == process_char_state_* ]] + name=conditional_operator + state_names+=($name) + printf -v conditional_operator %d 8 + export conditional_operator + (( ++states )) + read x x fn + [[ process_char_state_conditional_regex == process_char_state_* ]] + name=conditional_regex + state_names+=($name) + printf -v conditional_regex %d 9 + export conditional_regex + (( ++states )) + read x x fn + [[ process_char_state_conditional_whitespace == process_char_state_* ]] + name=conditional_whitespace + state_names+=($name) + printf -v conditional_whitespace %d 10 + export conditional_whitespace + (( ++states )) + read x x fn + [[ process_char_state_directive == process_char_state_* ]] + name=directive + state_names+=($name) + printf -v directive %d 11 + export directive + (( ++states )) + read x x fn + [[ process_char_state_directive_heredoc == process_char_state_* ]] + name=directive_heredoc + state_names+=($name) + printf -v directive_heredoc %d 12 + export directive_heredoc + (( ++states )) + read x x fn + [[ process_char_state_dollar == process_char_state_* ]] + name=dollar + state_names+=($name) + printf -v dollar %d 13 + export dollar + (( ++states )) + read x x fn + [[ process_char_state_escape == process_char_state_* ]] + name=escape + state_names+=($name) + printf -v escape %d 14 + export escape + (( ++states )) + read x x fn + [[ process_char_state_escape_sequence == process_char_state_* ]] + name=escape_sequence + state_names+=($name) + printf -v escape_sequence %d 15 + export escape_sequence + (( ++states )) + read x x fn + [[ process_char_state_expandcmd == process_char_state_* ]] + name=expandcmd + state_names+=($name) + printf -v expandcmd %d 16 + export expandcmd + (( ++states )) + read x x fn + [[ process_char_state_expandparam == process_char_state_* ]] + name=expandparam + state_names+=($name) + printf -v expandparam %d 17 + export expandparam + (( ++states )) + read x x fn + [[ process_char_state_expandvar == process_char_state_* ]] + name=expandvar + state_names+=($name) + printf -v expandvar %d 18 + export expandvar + (( ++states )) + read x x fn + [[ process_char_state_heredoc == process_char_state_* ]] + name=heredoc + state_names+=($name) + printf -v heredoc %d 19 + export heredoc + (( ++states )) + read x x fn + [[ process_char_state_heredoc_inline == process_char_state_* ]] + name=heredoc_inline + state_names+=($name) + printf -v heredoc_inline %d 20 + export heredoc_inline + (( ++states )) + read x x fn + [[ process_char_state_heredoc_tag == process_char_state_* ]] + name=heredoc_tag + state_names+=($name) + printf -v heredoc_tag %d 21 + export heredoc_tag + (( ++states )) + read x x fn + [[ process_char_state_heredoc_tagged == process_char_state_* ]] + name=heredoc_tagged + state_names+=($name) + printf -v heredoc_tagged %d 22 + export heredoc_tagged + (( ++states )) + read x x fn + [[ process_char_state_ifdef_exclude == process_char_state_* ]] + name=ifdef_exclude + state_names+=($name) + printf -v ifdef_exclude %d 23 + export ifdef_exclude + (( ++states )) + read x x fn + [[ process_char_state_ifdef_include == process_char_state_* ]] + name=ifdef_include + state_names+=($name) + printf -v ifdef_include %d 24 + export ifdef_include + (( ++states )) + read x x fn + [[ process_char_state_number == process_char_state_* ]] + name=number + state_names+=($name) + printf -v number %d 25 + export number + (( ++states )) + read x x fn + [[ process_char_state_parens == process_char_state_* ]] + name=parens + state_names+=($name) + printf -v parens %d 26 + export parens + (( ++states )) + read x x fn + [[ process_char_state_parsing == process_char_state_* ]] + name=parsing + state_names+=($name) + printf -v parsing %d 27 + export parsing + (( ++states )) + read x x fn + [[ process_char_state_parsing_string == process_char_state_* ]] + name=parsing_string + state_names+=($name) + printf -v parsing_string %d 28 + export parsing_string + (( ++states )) + read x x fn + [[ process_char_state_quote == process_char_state_* ]] + name=quote + state_names+=($name) + printf -v quote %d 29 + export quote + (( ++states )) + read x x fn + [[ process_char_state_redirect_fd == process_char_state_* ]] + name=redirect_fd + state_names+=($name) + printf -v redirect_fd %d 30 + export redirect_fd + (( ++states )) + read x x fn + [[ process_char_state_redirect_in == process_char_state_* ]] + name=redirect_in + state_names+=($name) + printf -v redirect_in %d 31 + export redirect_in + (( ++states )) + read x x fn + [[ process_char_state_redirect_out == process_char_state_* ]] + name=redirect_out + state_names+=($name) + printf -v redirect_out %d 32 + export redirect_out + (( ++states )) + read x x fn + [[ process_char_state_tick == process_char_state_* ]] + name=tick + state_names+=($name) + printf -v tick %d 33 + export tick + (( ++states )) + read x x fn + [[ process_char_state_word == process_char_state_* ]] + name=word + state_names+=($name) + printf -v word %d 34 + export word + (( ++states )) + read x x fn + [[ process_directive_define == process_char_state_* ]] + read x x fn + [[ process_directive_else == process_char_state_* ]] + read x x fn + [[ process_directive_endif == process_char_state_* ]] + read x x fn + [[ process_directive_error == process_char_state_* ]] + read x x fn + [[ process_directive_ifdef == process_char_state_* ]] + read x x fn + [[ process_directive_ifndef == process_char_state_* ]] + read x x fn + [[ process_directive_include == process_char_state_* ]] + read x x fn + [[ push_buf == process_char_state_* ]] + read x x fn + [[ push_heredoc == process_char_state_* ]] + read x x fn + [[ push_state == process_char_state_* ]] + read x x fn + [[ remove_define == process_char_state_* ]] + read x x fn + [[ stacktrace == process_char_state_* ]] + read x x fn + [[ switch_state == process_char_state_* ]] + read x x fn + [[ thaw_buf == process_char_state_* ]] + read x x fn + [[ undef == process_char_state_* ]] + read x x fn + [[ usage == process_char_state_* ]] + read x x fn + [[ warn == process_char_state_* ]] + read x x fn + local debug_states= + DEBUG_STATES= + for name in '"${state_names[@]}"' + printf -v eof %d 35 + export eof + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v apos %d 36 + export apos + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v arithmetic %d 37 + export arithmetic + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v bracket_c %d 38 + export bracket_c + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v bracket_s %d 39 + export bracket_s + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v comment %d 40 + export comment + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v conditional %d 41 + export conditional + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v conditional_end %d 42 + export conditional_end + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v conditional_operator %d 43 + export conditional_operator + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v conditional_regex %d 44 + export conditional_regex + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v conditional_whitespace %d 45 + export conditional_whitespace + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v directive %d 46 + export directive + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v directive_heredoc %d 47 + export directive_heredoc + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v dollar %d 48 + export dollar + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v escape %d 49 + export escape + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v escape_sequence %d 50 + export escape_sequence + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v expandcmd %d 51 + export expandcmd + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v expandparam %d 52 + export expandparam + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v expandvar %d 53 + export expandvar + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v heredoc %d 54 + export heredoc + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v heredoc_inline %d 55 + export heredoc_inline + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v heredoc_tag %d 56 + export heredoc_tag + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v heredoc_tagged %d 57 + export heredoc_tagged + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v ifdef_exclude %d 58 + export ifdef_exclude + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v ifdef_include %d 59 + export ifdef_include + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v number %d 60 + export number + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v parens %d 61 + export parens + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v parsing %d 62 + export parsing + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v parsing_string %d 63 + export parsing_string + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v quote %d 64 + export quote + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v redirect_fd %d 65 + export redirect_fd + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v redirect_in %d 66 + export redirect_in + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v redirect_out %d 67 + export redirect_out + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v tick %d 68 + export tick + (( ++states )) + local added=0 + [[ -n '' ]] + for name in '"${state_names[@]}"' + printf -v word %d 69 + export word + (( ++states )) + local added=0 + [[ -n '' ]] + st_name_default=eof + st_default=35 + (( 0 > 0 )) + (( DEBUG_LINENO > 0 && ! DEBUG )) bin/bashpp: line 1768: files[@]: unbound variable ++ cleanup ++ local exitcode=1 ++ (( exitcode != 0 )) ++ [[ /dev/stdout != \/\d\e\v\/* ]] $
Get an error when I run just the script by itself.
$ bin/bashpp
bin/bashpp: line 1768: files[@]: unbound variable
This is on AIX 7.1.
$ bin/bashpp
bin/bashpp: line 1768: files[@]: unbound variable
$ bash -x bin/bashpp
++ readlink -f bin/bashpp
..
.gitignore
README.md
bin
circle.yml
t
test.sh'
..
.gitignore
README.md
bin
circle.yml
t
test.sh'
'
'
'
++ declare -F
bin/bashpp: line 1768: files[@]: unbound variable
++ cleanup
++ local exitcode=1
++ (( exitcode != 0 ))
++ [[ /dev/stdout != /\d\e\v/* ]]
$