s/sed/GNU sed/
echoz.sh also uses cut, base64, stdbuf, tr, mkfifo, tee and sort.
echoz.sh does not seem to have any "bashisms" so perhaps one does not actually need bash and other sh will suffice.
stdbuf is absent from some BSD UNIX. Below is a small script to try to unbuffer output from any program without using LD_PRELOAD. base64 is also absent from some BSD UNIX and can be replaced with
openssl enc -a
tee can be replaced with sed -u w/dev/stdout
The uses of cut to isolate substrings and tr to replace characters can also be acomplished using sed. #!/bin/sh
test $# -ge 1||exec echo usage: $0 program arguments ;
maxarg=5;
test $# -le $maxarg||exec echo max $maxarg arguments ;
{
a=$#;
b=$(command -v $1);
echo -n ' #include <stdio.h>
int main(){
setvbuf(stdin,NULL,_IONBF,0);
setvbuf(stdout,NULL,_IONBF,0);
char *b['$((a+1))'];'
n=0;while true;do
test $n -le $maxarg||exit;
a=$((a-1));
test $a -ge 0||if export n;then echo;break;fi ;
echo -n '
b['$n']="'$1'";'
shift 1;
n=$((n+1));
done;
echo ' b['$n']=(void *)0;
execve("'$b'",b,(void *)0);
}';
}|exec cc -xc - -static && exec a.out