bin bash not found

I’m trying to run this Makefile in an alpine docker.

I have ascertained that both bash , make , go is there by interactively going into the container and checking all commands.

But this command mysteriously fails:

I have a real hard time debugging this as it’s in a docker and it’s jenkins that is executing everything.

Welcome to, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

Are you new to Visit the following links:
Site Howto | Site FAQ | Sitemap | Register Now

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux — A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author’s experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

i have a script

but when i try to run it i get this error: /root/ 1: /root/ #!/bin/sh: not found

1 Answer 1

Your script starts with:

This is not a comment, but a shebang to tell your operating system to use /bin/sh to execute the script. But apparently Ubuntu cannot find it.

If ls /bin/sh shows no result, then I guess that needs to be fixed. As a temporary solution, you might be lucky that your script also works with, for example, bash:

If /bin/sh does exist (like it should), then somehow Ubuntu cannot interpret that first line. Dump it as hex:

And with the result:

Make sure line endings are using the Unix format, LF (
or hexadecimal 0a ) instead of, for example, the Windows standard CRLF (
or hexadecimal 0d0a in the example above). On a Mac this would actually throw a different error:

Make sure file encodings do not mess up, such as an (invisible) Unicode BOM ( ef bb bf in the example output above). In the above example your shell is not seeing a comment or the shebang, but is trying to run a command that starts with 3 invisible characters. In this case your shell would probably still execute the next lines, or might even complete the script successfully. On a Mac the first line actually throws:

To dump the error message to see the invisible characters in that message, one needs to redirect the error output to the standard output:

Оцените статью