Docker Community Forums

Share and learn in the Docker community.

Typical bash script doesn't run in busybox sh

hi
could you please help me to run a shell script in busy-box which is run in Ubuntu terminal?
the below image contains a /var/mat.sh which has errors
docker pull embedhesam/embed
thanks

Please rephrase your post and describe what you did to get the error and paste the exact error.

I realy don’t understand why people tend to keep every detail to themself and think others can make sense out of it. Let me tell you: they can’t :wink:

It seems this is your own image: please share the github repo that hold everything to build the Dockerfile.

I consider it a security risk to use a custom image without beeing able to see the source used to build it.

the below is the shell script that has error in busybox bash:

#!/bin/bash
echo -e “\033[2J\033[?25l”;
R=`tput lines` C=`tput cols`;: $[R–] ;
while true
do ( e=echo\ -e s=sleep j=$[RANDOM%C] d=$[RANDOM%R];
for i in `eval $e {1…$R}`;
do c=`printf ‘\\0%o’ $[RANDOM%57+33]`
$e “\033[$[i-1];${j}H\033[32m$c\033[$i;${j}H\033[37m”$c; $s 0.1;
if [ $i -ge $d ]
then $e "\033[$[i-d];${j}H ";
fi;
done;
for i in `eval $e {$[i-d]…$R}`; #[mat!rix]
do echo -e "\033[$i;${j}f ";$s 0.1;done)& sleep 0.05;done

sorry my friend
as you said, for security reason i just share my shell script and busybox official image is here:
docker pull busybox
thanks

Uhm, the missing Dockerfile leaves room for assumption - I won’t make any.

Run docker run -ti -v $PWD/mat.sh:/var/mat.sh busybox sh (make sure to replace $PWD/mat.sh twith whatever path your script has) then call your script inside the container and go from there.

You will at least need to install bash itself and tput. Maybee printf and eval as well. Since you picked buisybox as a base image, I trust that you know how to install those commands into busybox.

Btw this is definitly not a typcial bash script :rofl:

update: I just checked out of curriosity. I am not sure why you picked busybox, but there is neither bash, nor tput available for it. You might be better of with an alpine base image.

1 Like