Questions tagged [shebang]

In computing, a shebang is the character sequence consisting of the characters number sign and exclamation mark (that is, "#!") at the beginning of a script.

Filter by
Sorted by
Tagged with
1 vote
0 answers
83 views

linux running a script on a mounted fritz-Box share result in "bad interpreter" in ubuntu 22.04, works on 18.04 (other shares work)

A script like: #!/usr/bin/env bash ... or #!/usr/bin/env python3 ... will result in (german): -bash: /mnt/Fritz-USB/FritzUSB/t.sh: /usr/bin/env: Defekter Interpreter: Eingabe-/Ausgabefehler ...
416 votes
4 answers
876k views

What is the difference between #!/bin/sh and #!/bin/bash?

if I write, #!/bin/bash echo "foo" or #!/bin/sh echo "foo" both yields same. I have seen some scripts starting with #!/bin/sh or #!/bin/bash. Is there any difference between them?
0 votes
0 answers
30 views

./docker-build.sh: ./mvnw: /bin/sh^M: bad interpreter: No such file or directory [duplicate]

I am using Ubuntu 22.04 File docker-build.sh #!/usr/bin/env bash if [ "$1" = "native" ]; then ./mvnw clean -Pnative spring-boot:build-image --projects book-service -DskipTests ...
1 vote
1 answer
135 views

Prompt string PS4 duplicating itself when using set -x

My OS: Ubuntu 18.04.5 LTS I use tracing for troubleshooting a script. I've notice different behaviors in the tracing depending on how I set it up. I would like to understand why it behaves this way. I ...
47 votes
3 answers
8k views

Is there a command for running a script according to its shebang line?

If I want to execute a bash script which doesn't have its execution permission set, I can do: bash script.sh What should I use instead of bash if the script isn't executable and I don't know the ...
18 votes
2 answers
48k views

How to make python shebang use python3?

I have a third party script that uses the shebang #!/usr/bin/env python. According to the python documentation, this is the correct form for scripts that are suitable for both Python v2 and Python v3 ...
2 votes
1 answer
932 views

Shebang line for Node does not work in Ubuntu 18

I have just created an Ubuntu 18.04 instance on AWS and copied an existing project over. The usual shebang line for Node #!/usr/bin/env node now doesn't work. It gave: #!/usr/bin/env: No such file ...
3 votes
2 answers
8k views

What is the shebang ( #!/bin/bash). [duplicate]

why do we use shebang in the beginning of a shell script file. does the script will run without it. I tried running it without shebang in shell script but it didn't run.
0 votes
1 answer
560 views

Python 2 interpreter instead of 3 in Geany

On my PC, Python 2 and 3 are installed – a query of the versions, using the terminal, outputs the following: $ python2 --version Python 2.7.14 $ python3 --version Python 3.6.3 I would like to ...
3 votes
3 answers
794 views

What is this line at the top of many files?

I have seen many files which have this line as the first line in them. What exactly is this? #!/usr/bin/env python What does it mean? Why is it necessary?
-4 votes
1 answer
609 views

What is "#!' in a script file? [duplicate]

$cat shebang.sed #! /bin/sed -f s/red/xxx/ s/BLUE/1234/ $./shebang.sed rgb lower (#1): "xxx green blue" UPPER (#2): "RED GREEN 1234" $sed -f shebang.sed rgb lower (#1): "xxx green blue" UPPER (#2): ...
0 votes
1 answer
1k views

Python shebang line

I am trying to execute a script in python as a cgi script using apache2. However instead of executing, the file gets downloaded. I have allowed my python file to be an executable. I think this is ...
0 votes
1 answer
90 views

Ubuntu execute file without ./

Using a shebang line, I added the functionality to launch a TCL script using the wish shell. However, I can only quickly launch the file by typing ./filename.tcl in the terminal. I would like to know, ...
25 votes
3 answers
8k views

What type of path in shebang is more preferable?

In scripts, first line should specify the path to interpreter. But on different servers Linux, Unix, or BSD this path could be different. What is more preferable? #!/usr/bin/env bash or #!/bin/...