Linked Questions

1
vote
1answer
88 views

Why does a script without she-bang can be run? [duplicate]

As far as I understand, to make kernel execve a non-ELF file, the file must be a script started with a she-bang #!, but I have a script run successfully without it, why does this happen? xtricman⚓...
0
votes
2answers
87 views

How can I make a bash counter script work when executing it from another script? [duplicate]

I have a script that uses wget and saves the output to a file with a name of an incrementing variable. Counter.sh: number=1 for i in $(cat file) do wget $i -S -O $number.html 2>&1 ((number++))...
1
vote
1answer
97 views

what shell is used to run a script [duplicate]

I have some points I want to understand: I have a script written in bash syntax and does not contain the shebang line (#!/bin/bash) and my default shell is tcsh. when giving execute permission to the ...
11
votes
6answers
2k views

Too many shebang (script declaration) lines — any way to reduce their amount?

I have a project comprised of about 20 small .sh files. I name these "small" because generally, no file has more than 20 lines of code. I took a modular approach because thus I'm loyal to the Unix ...
17
votes
3answers
2k views

Why is the behavior of the `#!` syntax unspecified by POSIX?

From the Shell Command Language page of the POSIX specification: If the first line of a file of shell commands starts with the characters "#!", the results are unspecified. Why is the behavior of #...
10
votes
3answers
3k views

Running a shell script when “/bin/sh” points to “/bin/bash”

I have read the following in this question: bash supports a --posix switch, which makes it more POSIX-compliant. It also tries to mimic POSIX if invoked as sh. The above quote assumes that /bin/...
13
votes
3answers
2k views

Why doesn't “ps ax” find a running bash script without the “#!” header?

When I run this script, intended to run until killed... # foo.sh while true; do sleep 1; done ...I'm not able to find it using ps ax: >./foo.sh // In a separate shell: >ps ax | grep foo.sh ...
14
votes
2answers
854 views

How does this shebang that starts with a double hyphen (--) work?

I have found the following kind of shebang in the RosettaCode page: --() { :; }; exec db2 -txf "$0" It works for Db2, and a similar thing for Postgres. However, I do not understand the whole line. ...
6
votes
3answers
919 views

Can I use a variable content as a shebang? [closed]

I have a shell script in which I want to add a shebang. Given a variable defined as follows: SHEBANG="#!/bin/sh" My question is if I can use that variable in another script like this: $SHEBANG # ...
5
votes
2answers
602 views

Error when running ((x++)) as root

I make bash script temp.sh with the following content: age=0; ((age++)); When I run it as a normal user, it runs fine. But when i run it as root I get error: ./temp.sh: 4: ./temp.sh: age++: not ...
2
votes
2answers
2k views

how to let sudo fork bash instead of sh?

according to sudo(8): Process model When sudo runs a command, it calls fork(2), sets up the execution environment as described above, and calls the execve system call in the child process. ...
4
votes
2answers
362 views

fish shell : exec format error

On an Ubuntu ($ uname -a : Linux kumanaku 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux), I just installed fish ($ fish --version : fish, version 2.7.1) ...
7
votes
1answer
457 views

Shells with the ability to treat `\r` as a whitespace character

As a personal project, I'm trying to write a script to clean up some of the extraneous files that ship with Windows 10 that runs under Cygwin. I'd like the script to be copy and paste-able, which ...
1
vote
1answer
398 views

systemd service active but not executing

I have the following launcher.sh file: cd /root/craig/mybot tmux new-session -d -s mybot "'/usr/bin/python3.5' launcher.py --start --auto-restart" I then have the following mybot.service file in /...
3
votes
1answer
786 views

Running python script on ubuntu machine using ./myscript.py

I am running a python script named myscript.py on ubuntu machine. I usually use python command to run python scripts as below. python main.py Recently, I downloaded a python script from a Github ...

15 30 50 per page