bb's bash errors in a script that works in normal bash

daggs daggs at gmx.com
Tue Aug 25 12:39:04 UTC 2020


Greetings,

I have the following script:
$ cat test1.sh
#!/bin/bash -x

do_trace() {
    local depth=0

    [ -z "${CT_XLDD_VERBOSE}" ] && return 0

    for((depth=0; "${#FUNCNAME[$((depth+1))]}" != 0; depth++)); do :; done
    printf "%*s" $((4*(depth-1))) "" >&2
    printf -- "$@" >&2
}

do_trace

when I run it with normal bash it works, with bb's bash it doesn't, see:

$ /tmp/busybox-1.32.0/busybox bash ./test1.sh
bash: syntax error: unterminated ${name}
    BusyBox v1.32.0 (2020-08-25 15:22:10 IDT) multi-call binary.

Usage: bash [-enxl] [-c 'SCRIPT' [ARG0 [ARGS]] / FILE [ARGS] / -s [ARGS]]

Unix shell interpreter
$  ./test1.sh
+ do_trace
+ local depth=0
+ '[' -z '' ']'
+ return 0

as I understand it, FUNCNAME is not implemented in bb, am I correct?

Thanks,

Dagg.


More information about the busybox mailing list