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

daggs daggs at gmx.com
Tue Aug 25 21:03:02 UTC 2020


Greetings,

is there a way to workaround it somehow?

> Sent: Tuesday, August 25, 2020 at 7:11 PM
> From: "Markus Gothe" <nietzsche at lysator.liu.se>
> To: "daggs" <daggs at gmx.com>, busybox at busybox.net
> Subject: Re: bb's bash errors in a script that works in normal bash
>
> Correct, it is not part of the Almquist shell. So it not supported yet AFAIK, however in busybox there are some bash-compatiblity hacks so it might be implemented one day.
> 
> //Markus
> 
> Sent from my BlackBerry - the most secure mobile device
> 
> 
> 	  Original Message  	
> 
> 
> From: daggs at gmx.com
> Sent: August 25, 2020 14:39
> To: busybox at busybox.net
> Subject: bb's bash errors in a script that works in normal bash
> 
> 
> 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.
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>


More information about the busybox mailing list