Giter Club home page Giter Club logo

bashpp's Introduction

Bash Pre-Processor

Circle CI

There are certain instances where you need to statically include other scripts within a primary single script. For example, RPM spec %pre scripts can't utilise any scripts that are deployed during the installation of an RPM, because those scripts just simply aren't available. In those situations, you need a mechanism through which you can perform CPP style static inclusions of other files. The Bash Pre-Processor hopes to solve this problem, by providing the functionality of the C Pre-Processor, targeted at Bash scripts.

This tool is written in Bash, so itt may not perform as well as other scripts written in Python or Perl, but Bash Pre-Processor aims to be as portable as possible, requiring only Bash and core utilities.

Controlling Bash Pre-Processor

You can control the behaviour of the Bash Pre-Processor through the use of environment variables or through command line switches.

Supported Directives

#include

Include a file defined in the standard include path, defined by the BASHINC environment variable or paths specified with the -I dir flag.

#include "path/filename"

Include a file relative to the directory of the file being processed. If the path starts with a forward slash, then the path is searched relative to the root file system.

#define NAME VALUE

Create a new definition. If NAME is already defined, bashpp will terminate with an error message.

#undef NAME

Undefine the NAME definition if defined. If NAME is not defined, NAME will remain undefined.

#ifdef NAME

If NAME is defined, everything that follows to the #endif or #else statement is written to the output file. If NAME is undefined, everything that follows is omitted.

#ifndef NAME

Negated implementation of #ifdef

#else

Inverse of the preceding #ifdef or #ifndef expression.

Command Line Options

For command line options, see the usage by running:

$ bashpp --help

Here are the options as of 7 Aug 2015.

Usage: bashpp [options] file...
Options:
  -I dir                Add the directory defined by dir to the include path.

  -D name               Predefine name as a macro, with definition 1.

  -D name=definition    The contents of definition are tokenized and processed
                        as if they appeared during translation in a #define
                        directive.

                        If you are invoking the preprocessor from a shell or
                        shell-like program you may need to use the shell's
                        quoting syntax to protect characters such as spaces that
                        have a meaning in the shell syntax.

                        -D and -U options are processed in the order they are
                        given on the command line.

  -o file               Place the output into <file>

  -v                    Verbose mode.

Arguments:
    file                Specify an input file.  By default, input is read from
                        standard input.

Copyright (C) 2015 Craig Phillips.  All rights reserved.

bashpp's People

Contributors

iwonbigbro avatar cmcdragonkai avatar

Stargazers

Jeremy Bensimon avatar velzie avatar Casey Kelso avatar 1 7 3 dup rot avatar Ektor_Makras avatar  avatar pavlos noulis avatar Jiří Altman avatar Jacobo de Vera avatar EpopE avatar cmolina avatar  avatar .mpe avatar Alix Axel avatar Mayeu avatar Donghyun Kim avatar Norton avatar Trav Easton avatar Chris White avatar Robert Hopson avatar xinsfang avatar Jonathan Zaehringer avatar  avatar Gregory Eremin avatar

Watchers

James Cloos avatar  avatar cmolina avatar

bashpp's Issues

Inclusion requires a directory path or else it doesn't work

Try this:

mkdir testbashpp
cd testbashpp
touch inclusion
touch shell_environment

Inside inclusion, put in:

#include "./shell_environment"

Inside shell_environment, put in:

blah

Now as your PWD is testbashpp, run:

bashpp inclusion

It will come up with an error.

To make it work you have to:

cd ..
bashpp testbashpp/inclusion

When you run bashpp against the script while inside the same PWD that the script is in, bashpp cannot include, as the path is incorrect. It gives me no such directory error.

Does this duplicate m4?

Having googled 'bash preprocessor', I have come here to Bash Pre-Processor

In developing bash scripts, I have found it handy to run 'bash -n' on them beforehand, as well as shellcheck. In my ponderings, I am also (re-)minded of make.

In considering (googling) the idea of a bash preprocessor, I have also come across 'm4'.

Are there dis/advantages to using bashpp instead of m4, and acclimating it instead of the other?

Normal comments

Why are normal comments failing?

#this is a comment

But this works:

# this is a comment

Shouldn't we only parse things that are actual directives?

Doesn't work with bash-3.2.57(1)-release

Getting this error:

util/bashpp.sh: line 44: declare: -A: invalid option

when executing:

util/bashpp.sh -o values.yaml values.yaml.tmpl

But it works with bash version 5.0.17(1)-release.

If the bashpp doesn't support some versions of bash - it would be great to note it somewhere or add check into the script.

bin/bashpp: line 1768: files[@]: unbound variabl

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/* ]]

$

Newline error

This simple file fails to be parsed:

#ifdef LOL

hahahah

#endif

It requires an empty newline:

#ifdef LOL

hahahah

#endif

The error is:

 ± ./bpp -D LOL testfile                                                                                                                    16-03-31 22:48:16

hahahah

Traceback:
  ./bpp:iter_file():1590:         die "frozen buffer"
  ./bpp:iter_files():1517:         iter_file "$f"
  ./bpp:main():1761: iter_files "${files[@]}" >"$output"
testfile:5:7 error: frozen buffer
  #endif
  ......^

By the way, this is freaking awesome!

tocode is missing

AIX 7.1 and get this error.

$ ./test.sh
tocode is missing
Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
Usage: iconv -l
tocode is missing
Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
Usage: iconv -l
tocode is missing
Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
Usage: iconv -l
tocode is missing
Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
Usage: iconv -l
mkdir: cannot access directory test.sh.
test.sh: Not a directory
t/test_.sh./test.sh: line 62: test.sh/t/test_.sh.o: Not a directory
./test.sh: line 71: test.sh/t/test_.sh.f: Not a directory
test.sh/t/test_
.sh.t: Not a directory
t/test_*.sh

$ bash -x test.sh
++ readlink -m test.sh/../t

  • t=test.sh
    ++ readlink -m test.sh/../BUILDROOT
  • b=test.sh
  • rm -rf test.sh/t
  • e=0
  • bash_opts=
    ++ printf '\x25\xCF'
    ++ iconv -f utf-16be
    tocode is missing
    Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
    Usage: iconv -l
  • R=''
    ++ iconv -f utf-16be
    tocode is missing
    Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
    Usage: iconv -l
    ++ printf '\x25\xBA'
  • S=''
    ++ printf '\x27\x18'
    ++ iconv -f utf-16be
    tocode is missing
    Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
    Usage: iconv -l
  • F=''
    ++ printf '\x27\x14'
    ++ iconv -f utf-16be
    tocode is missing
    Usage: iconv [-c] [-s] -f FromCode -t ToCode [FileName...]
    Usage: iconv -l
  • P=''
  • mkdir -p test.sh/t
    mkdir: cannot access directory test.sh.
    test.sh: Not a directory
  • trap true INT
  • [[ '' == 1 ]]
    ++ declare -f assert
  • export 'USE_ASSERT=function assert ()
    {
    local lines=() lineno=${BASH_LINENO[0]};
    mapfile -tn1 -s$((lineno-1)) lines < "${BASH_SOURCE[1]}";
    printf "ASSERT: ${BASH_SOURCE[1]##*/}:$lineno: %s\n" "$lines";
    exit 1
    }'
  • USE_ASSERT='function assert ()
    {
    local lines=() lineno=${BASH_LINENO[0]};
    mapfile -tn1 -s$((lineno-1)) lines < "${BASH_SOURCE[1]}";
    printf "ASSERT: ${BASH_SOURCE[1]##*/}:$lineno: %s\n" "$lines";
    exit 1
    }'
  • hash time
  • true
  • count=0
  • for f in '$t/test_${1:-*}.sh'
  • ff='t/test_*.sh'
  • (( ++count ))
  • printf ' %s' 't/test_.sh'
    t/test_
    .sh+ export bash_opts
  • ret=0
  • time_fn bash 'test.sh/test_.sh'
    test.sh: line 62: test.sh/t/test_
    .sh.o: Not a directory
  • ret=1
  • (( ret == 0 ))
  • (( ret == 80 ))
  • :
    test.sh: line 71: test.sh/t/test_.sh.f: Not a directory
    ++ tail -1 'test.sh/t/test_
    .sh.t'
    test.sh/t/test_*.sh.t: Not a directory
  • printf '\r %s%s\n' 't/test_.sh' ''
    t/test_
    .sh
  • [[ '' == 1 ]]
  • e=1
  • [[ '' == 1 ]]
  • break
  • [[ '' == *.xml ]]
  • exit 1

$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.