On Wed, Mar 14, 2018 at 08:43:45AM -0400, Greg Wooledge wrote:
> > 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
Hi Eduardo (and all),
I was actually not doing anything useful, just playing with bash. I've got
so used to putting '#! /bin/bash' at the top of the file, that I've
completely forgotten that bash will attempt to execute commands even
without hash-bang. Compounded to that, intuitively, I didn't exp
On 3/14/18 4:02 PM, Eduardo Bustamante wrote:
> On Tue, Mar 13, 2018 at 11:34 PM, Vladimir Likic wrote:
>> Sorry, meant why is bash executing the file without hash-bang '#!' ?
>
> You can see the answer here:
> http://git.savannah.gnu.org/cgit/bash.git/tree/execute_cmd.c?h=devel&id=bf5b8103d466f
(I've added bug-bash again)
On Tue, Mar 13, 2018 at 11:32 PM, Vladimir Likic wrote:
> Thanks for the quick response!
> Your are correct, "." was in PATH (my bad), an it's calling itself
> recursively. That went into a spiral and crashed the computer (literally).
> Why is bash actually executing
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 script
On Tue, Mar 13, 2018 at 10:29:22PM -0600, Eduardo Bustamante wrote:
> On Tue, Mar 13, 2018 at 7:24 PM, Vladimir Likic wrote:
> > Repeat-By:
> >
> > $ echo junk > junk
> > $ chmod +x junk
> > $./junk
> > --> this completely destroys my system
Only if you have "." in your $PATH (or a function named
On Tue, Mar 13, 2018 at 7:24 PM, Vladimir Likic wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-lin
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE