Questions tagged [shebang]

The #! marker at the beginning of scripts is called a shebang.

The #! marker at the beginning of scripts is called a shebang.

See

486 questions
0
votes
3 answers

Identical shebang not working

So I'm trying to create some scripts that I want to run without manually specifying the interpreter each time I run it. #!/usr/bin/python Above is the shebang on an existing script that runs like I want it to. Below is the shebang of a script I…
Dhruv Govil
  • 349
  • 1
  • 3
  • 13
0
votes
2 answers

Why does directly run script not work but "python script_name.py" does

I wrote a script to scraping data from a site. It works when I run it with "python script.py" but when chmod +x and run directly from shell, it not work properly (not overwrite the output file) here is my code (just try to use…
HVNSweeting
  • 2,859
  • 2
  • 35
  • 30
-1
votes
1 answer

Quitting and restarting

I have this bash script that restarts/monitors myscript while { myscript; rc=$?; true; }; do echo "'myscript' crashed with exit code $rc. Restarting..." >&2 sleep 1 done basically myscript is a python script that's supposed to continuously…
supra
  • 1
  • 2
-1
votes
1 answer

Python3 shebang -bash: ./main.py: Permission denied

Please actually read my post instead of just the title. This is a larger system issue, not a typo or a file permissions issue. I am attempting to run my script without having to type in 'python3' before every test run, and potentially to make…
Binsky734
  • 11
  • 5
-1
votes
2 answers

Does the hashbang (#!) have any functionality client side?

I recently learned about the hashbang syntax for writing comments in JavaScript, and need to know if it is or has the potential to be any different then just putting a // at the top of a file. Are there any conventions associated with the…
luek baja
  • 1,475
  • 8
  • 20
-1
votes
1 answer

How do I run a java class with a shebang line on Windows?

I have some java utilities written to be used with the shebang line supported by Java 11. They work fine on my Mac, but I now need to use them on Windows, and Windows doesn't support the shebang line, Is there a way to do this?
MiguelMunoz
  • 4,548
  • 3
  • 34
  • 51
-1
votes
1 answer

.sh No such file or directory, file does exist

The file exists, I see it in the relative path scripts/start_app.sh. I have the shebang correct at the top. I'm using Ubuntu 22.04 and I've updated the packages by running: sudo dpkg --add-architecture i386 sudo apt-get install libc6:i386…
-1
votes
1 answer

bash ignores shebang when running file passed as argument

How can I have bash respect the shebang when passing a file as an argument? eg: hello.py #!/usr/bin/env python print("Hello Python") When passed to bash: $ bash hello.py hello.py: line 2: syntax error near unexpected token `"Hello…
tekumara
  • 8,357
  • 10
  • 57
  • 69
-1
votes
2 answers

How to run node.js file without typing "node abc.js" in command line in Windows in VSCode?

I'm trying to run this script in vscode :- #!"C:\Program Files\nodejs\node.exe" console.log("Hello world"); And in command line I enter :- ./abc.js Each time I run this, the cursor goes to the end of script. Whereas, I'm trying to see "Hello…
Tanish
  • 35
  • 4
-1
votes
2 answers

/usr/bin/mount: not found in a .sh script

The first line of my script is /usr/bin/mount /dev/sdb4 /media/user/Data Running it I get /home/patrick/Scripts/DataBackup.sh: 1: /home/patrick/Scripts/DataBackup.sh: /usr/bin/mount: not found Even if I put sudo before the mount command it does…
Lucens
  • 1
  • 1
-1
votes
1 answer

shebang not working to run bash scripts in linux

I can't seem to get bash scripts to turn into executable files via shebang. My code looks like #!/bin/bash echo "hello" where this is in a file called test.sh. I'm trying to get it to run with the command ./test.sh in the command line but i just…
-1
votes
1 answer

About python "#!usr/bin/env python"?

I put "#!usr/bin/env python" at the first line in coroutine.py, but when I try to run coroutine.py directly by "./test.py", I get this: zsh: ./coroutine.py: bad interpreter: usr/bin/env: no such file or directory Is that something wrong in my…
Koen
  • 311
  • 2
  • 11
-1
votes
1 answer

Works in terminal but not in script

pip install sphinx sphinx-quickstart -q -p DSPackageDocs -a Me -v 1 --ext-autodoc perl -i -e $'s/#sys.path.insert(0, os.path.abspath(\'.\'))/sys.path.insert(0, os.path.abspath(\'.\/DSPackage\'))/g' conf.py The 3rd line looks into a file and…
jtaylor
  • 45
  • 6
-1
votes
1 answer

Using `touch` command, recognize file type and auto-generate shebang?

So, I really like the fact that text editors such as Vim allows you to auto-write text (most of the times shebangs) when creating a new file with a specific file extension. However, I'd like to know if there's any way to do it from the terminal…
Eddo Hintoso
  • 1,442
  • 14
  • 22
-1
votes
4 answers

Python shebang not working

Python is installed at: C:/Python/Python35 At the top of my program I put: #!/usr/bin/env python3 I opened windows command prompt and entered: ./words.py The message I got was: "." is not recognized I was told this should work great on Windows…
Jasmine
  • 1
  • 1
  • 2
1 2 3
32
33