The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
28 views

Why does trying to run a python executable return ': No such file or directory' after transferring it to server via FTP? [duplicate]

I'm having an issue where when I transfer a Python file to my VPS via FTP and try to run it using ./foo.py I am returned with the error: : No such file or directory. The error seams to indicate that ...
1
vote
1answer
57 views

When to use #!/bin/ksh and #!/bin/sh? Need example [duplicate]

Also what are the main differences between these two. To execute a script is it necessary to write this at the beginning of script?
8
votes
2answers
448 views

Multiple shebangs in a single bash file

I have a script from other person which has a look (note: it's a single file): #!/bin/bash some commands some commands #!/bin/bash some commands some commands #!/bin/bash some commands some ...
0
votes
0answers
18 views

Bash Scripts arguments and G++ static and dynamic library generation [duplicate]

I have a library named matrix.cpp that is used by a program named test.cpp. Now, I want to write a BASH script which takes matrix.h and matrix.cpp as input and generates matrix.a and matrix.so ...
2
votes
0answers
37 views

Why won't my python scripts run without the python command when moved from Windows to Linux? [duplicate]

I have some Python files that I wrote on my Windows PC and then sent over to a Linux machine using pscp. They work as intended on Windows, but when I try to execute them on the Linux machine, I always ...
6
votes
1answer
2k views

No such file or directory but I can see it!

I'm trying to run a python script, on a headless Raspberry PI using winSCP and get the following error message: Command '"./areadetect_movie_21.py"' failed with return code 127 and error message ...
1
vote
2answers
1k views

Use .sh or .bash extension for bash scripts?

(See Use #!/bin/sh or #!/bin/bash for Ubuntu-OSX compatibility and ease of use & POSIX) If I want my scripts to use the bash shell, does using the .bash extension actually invoke bash or does it ...
2
votes
2answers
78 views

Is it better to use a shebang line to execute a script?

I was looking up shebang and wondering why I would use it. I could execute a bash script using: bash foo.sh or ./foo.sh (with a shebang line in foo.sh) What are the pros and cons of each and ...
2
votes
2answers
111 views

Creating a shebang pointing portably to an interpreter in the folder of a script

I have a JS file (file.js) that I want to have executed as a command line shell script through nodejs (iojs actually); I'm using MINGW Git Bash on Windows. The standard way to do it is to put the ...
1
vote
3answers
225 views

How to pass arguments to the shebang interpreter when executing a script?

Say I have my.script such as #!/bin/bash blah blah and the bash interpreter accepts a --verbose argument. How do I execute my.script passing --verbose to bash? I know I can do bash --verbose ...
3
votes
2answers
64 views

Distance of a command from a shebang?

A shebang (#!/bin/sh) is placed on the first line of a bash script, and it's usually followed on the second line by a comment describing what action the script performs. What if, for no particular ...
52
votes
2answers
3k views

Shebang starting with `//`?

I'm confused about following script (hello.go). //usr/bin/env go run $0 $@ ; exit package main import "fmt" func main() { fmt.Printf("hello, world\n") } It can execute. (on MacOS X 10.9.5) $ ...
5
votes
2answers
5k views

Run script in a screen

I want to run a bash script in a detached screen. The script calls a program a few times, each of which takes too long to wait. My first thought was to simply open a screen and then call the script, ...
0
votes
2answers
263 views

Is this a valid shebang line?

I have the following question about UNIX: What else is needed when the top line goes #!\bin\awk -f to make it run as a command? I am thinking whatever the name of the script is it ...
-3
votes
3answers
428 views

Why is “shebang” called “shebang”?

Does "shebang" mean "bang she"? Why not "hebang" as "bang he"?
4
votes
1answer
3k views

Bash Script Permission denied & Bad Interpreter

I'm on a kali linux 64 bit. I have created a python script which takes 2 arguments to start. I don't want to type out every time the exact same paths or search in the history of the commands I used ...
3
votes
0answers
175 views

Shebang: History and Purpose [closed]

I have few questions about the magic number #!, the shebang. I read that it was introduced by Dennis Ritchie in the 70s as a way to see a script as an executable file. I don't understand, why it was ...
4
votes
2answers
1k views

What do the arguments '-v' and '-x' mean to bash?

I have seen a couple of shell scripts with the following shebang: #!/bin/bash -x -v However, man bash does not explain what these arguments -x and -v stand for, if they are belong to bash at all. ...
7
votes
2answers
757 views

shell script header for best compatibility [duplicate]

Which one is better: #!/usr/bin/env sh #!/bin/sh empty/no header I used to think the 1st one is the best, anyway i've found on some Linux-based systems (like Android) that pathname is missing, so ...
1
vote
1answer
304 views

How to control buffering of pipes in bash scripts?

I need my script to be executed with stdbuf -i0 -o0 -e0 otherwise user will wonder why there is no output (becuase of pipe buffer). How can I acheive it? #!/usr/bin/stdbuf -i0 -o0 -e0 /bin/bash ...
5
votes
2answers
176 views

run perl script with unknown perl location

I'm developing a perl script which expected to be downloaded by Mac users with a very small knowledge of shell, linux etc, let's say office managers and accountants. After the downloading the script ...
0
votes
3answers
388 views

Shell attempts to interpret Perl script in spite of correct shebang [closed]

I have looked through the forums and I can't seem to find how to fix this. I have a very simple perl code that works fine on Windows, but when I try it on Linux and Solaris I get the following errors: ...
7
votes
1answer
480 views

shebang line not working with cr-lf

Why are the shebang parts of the following elementary scripts not working: $ cat hello.sh #! /bin/sh echo Hello $ ./hello.sh bash: ./hello.sh: /bin/sh^M: bad interpreter: No such file or directory $ ...
8
votes
3answers
705 views

Distributing a script: Should I use /bin/gawk or /usr/bin/gawk for shebang?

Is gawk in /bin or /usr/bin usually? I would go with #!/usr/bin/env gawk but then I can't use arguments. Right now I'm using #!/bin/gawk -f. The script is very long and contains a lot of single ...
5
votes
4answers
8k views

Running python script from Linux Terminal

I have downloaded this script named, pyAES.py and put it in a folder name codes, inside a Desktop directory of my Linux, According to this example, ...
5
votes
1answer
650 views

Perl and Python wrongly interpreted via shebang on Linux

that problem just drives me crazy. All my Python and Perl scripts are simply NOT iterpreted via shebang. Never. But they work as expected when I explicitly call the binary. I double checked my ...
6
votes
1answer
178 views

What is the difference in these two bash environments?

I notice that with bash scripts, some people use a different shebang to the one that I'm used to putting at the top of my own. Can someone simplify the difference between these two? I use the ...
6
votes
4answers
831 views

Why no shebang in .bashrc/.bash_profile?

Simple inquiry: I have just realized that I have never seen a shebang on top of a .bashrc script, which leads me to think the system uses the default shell to source it upon login (${SHELL}). I am ...
23
votes
4answers
7k views

Does the shebang determine the shell which runs the script?

This may be a silly question, but I ask it still. If I have declared a shebang #!/bin/bash in the beginning of my_shell_script.sh, so do I always have to invoke this script using bash ...
2
votes
5answers
1k views

Why is the first line comment of .sh file necessary? [duplicate]

I was told that the first line shebang (#!/bin/bash) is necessary in the shell script file, and the file won't run accurately without this line. But I tested some scripts. They work just fine without ...
13
votes
3answers
948 views

Why not use pathless shebangs?

Is it possible to have a shebang that, instead of specifying a path to an interpreter, it has the name of the interpreter, and lets the shell find it through $PATH? If not, is there a reason why?
4
votes
3answers
2k views

How to share a GNU sed script between Linux and Mac OS X

I have a GNU sed script I use on Linux; it is installed at /bin/sed and it seems it contains GNUisms. I have collaborators using Mac OS X. They have installed (non-GNU) sed, located at /usr/bin/sed, ...
2
votes
2answers
3k views

/usr/bin/env: zsh -: No such file or directory

I get the error /usr/bin/env: zsh -: No such file or directory ...when I run an executable zsh script that starts with the following shebang line: #!/usr/bin/env zsh - Also, FWIW, replacing - ...
0
votes
2answers
218 views

can something besides the shebang set the interpreter? [closed]

I'm running a script (in tmuxinator) that tries to source another script (rvm). rvm explicitly does not allow sourcing from sh. I didn't think that would be a problem, because the shebang in the ...
12
votes
6answers
6k views

Is it recommended to use zsh instead of bash scripts?

Can I assume that enough people have zsh installed to run scripts with a #!/usr/bin/env zsh as shebang? Or will this make my scripts un-runnable on too many systems? Clarification: I’m interested ...
0
votes
3answers
451 views

Is shebang always the same as the interpreter's installation directory?

Must the shebang header always match the interpreter's installation directory? If so, then why do both #!/usr/bin/python and #!/usr/local/bin/python work for me?
15
votes
5answers
21k views

#!/bin/bash - no such file or directory

I've created a bash script but when I try to execute it, I get #!/bin/bash no such file or directory I need to run the command: bash script.sh for it to work. How can I fix this?