7

I am on Linux Mint 19.03.

I have a setup shell script file, setup.sh. When I run ./setup.sh

muyustan@mint:~/Downloads/quartusExtracted$ ./setup.sh 
bash: ./setup.sh: /bin/env: bad interpreter: No such file or directory

The shebang in setup.sh:

#!/bin/env bash

My understanding of these things are very narrow, since I am pretty new at Linux world.

I knew that, using /bin/env bash instead of giving the exact bash path was something like "search in the environment variables and try to find bash". When I look to /bin directory for env, I see that there is not such file:

muyustan@mint:/usr/bin$ ll /bin | grep "env"
lrwxrwxrwx  1 root root       6 Mar 21 14:35 open -> openvt*
-rwxr-xr-x  1 root root   18872 Jan 22  2018 openvt*

Also,

muyustan@mint:~/Downloads/quartusExtracted$ which bash
/bin/bash

So, I assume that changing the shebang in the setup.sh to #! /bin/bash will solve the problem(I haven't tried), however, this does not seem very intuitive, because if so then I ask myself that,

" Did the developers of this application(Quartus 13.1) make a mistake? ", which leads me to think that something is wrong with my system.

So, the question is, why this is the situation?

Thanks.

2
  • 5
    Chnage #!/bin/env bash` to #!/usr/bin/env bash Commented Mar 22, 2020 at 22:13
  • Comments are not for extended discussion; this conversation has been moved to chat. Commented Mar 25, 2020 at 14:10

1 Answer 1

15

Nothing is wrong with your system, you're just using the wrong path to env. On Linux systems, at least, the env binary is normally in /usr/bin and not /bin:

$ type env
env is /usr/bin/env

So, your script is telling your system to use /bin/env, which doesn't exist, and that's why you're getting that error. Simply change to the right shebang and you should be fine:

#!/usr/bin/env bash
1
  • Using env instead of /usr/bin/env also caused this issue for me, manifesting in a bizarre sh: 1: my-script-name: not found error when trying to invoke my script via npx. Thanks! Commented Jan 30, 2023 at 22:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.