On 14.3. 14:43, Greg Wooledge wrote:
This is ONE of the reasons why you should never put "." into your $PATH.

Well, the script could just contain `./junk` or `$0` instead and it would probably work regardless of PATH. Probably just better not to write self-recursing scripts; nor to run scripts whose behaviour isn't known.

At least that was a linear fork-loop, which is likely easier to stop than the exponential kind you usually see as a fork bomb.

1) You do not provide a hash-bang (i.e. #!/bin/bash), which means that
/bin/sh will be used (

No, that's incorrect.  When bash tells the operating system to run
this program, the operating system will return ENOEXEC (Exec format
error).  Bash (and every other shell) will catch this and spawn a
child copy of itself to try to interpret the program as a script.

Bash runs the script itself, Zsh and Dash run /bin/sh .
In the end it does get interpreted as a shell script, in both cases.

https://unix.stackexchange.com/questions/373223/which-shell-interpreter-runs-a-script-with-no-shebang


--
Ilkka Virta / itvi...@iki.fi

Reply via email to