Re: ./script doesn't work in completion function

2024-01-22 Thread Martin D Kealey
Chet has since pointed out that the debugger is not involved at all. On Mon, 22 Jan 2024, 18:17 Grisha Levit, wrote: > > That's not quite what happens. These scripts get executed by forking the > current bash process (without exec). The new shell resets its state and > runs the script. > I'm br

Re: ./script doesn't work in completion function

2024-01-22 Thread Chet Ramey
On 1/22/24 8:02 AM, Oğuz wrote: On Mon, Jan 22, 2024 at 3:25 PM Greg Wooledge wrote: But in any case, writing a "script" without a shebang and then counting on the shell to work around the broken script is not ideal. Unlike shebangs that behavior is standardized. Which is what I consider ideal

Re: ./script doesn't work in completion function

2024-01-22 Thread Chet Ramey
On 1/22/24 1:53 AM, Martin D Kealey wrote: Hi Oğuz On Sun, 21 Jan 2024 at 03:20, Oğuz wrote: $ echo echo foo bar >s $ chmod +x s You seem to have created an invalid executable. It seems that scripts without a #! can only be run with help from the debugger library; This isn't co

Re: ./script doesn't work in completion function

2024-01-22 Thread Chet Ramey
On 1/20/24 12:20 PM, Oğuz wrote: See: $ echo echo foo bar >s $ chmod +x s $ f(){ COMPREPLY=($(bash ./s));} $ complete -F f g $ $ g bar foo $ g ^C $ $ f(){ COMPREPLY=($(./s));} $ g ^C^C $ I press tab after typing `g ' in bo

Re: ./script doesn't work in completion function

2024-01-22 Thread Oğuz
On Mon, Jan 22, 2024 at 3:25 PM Greg Wooledge wrote: > But in any case, writing a "script" without a shebang and then counting > on the shell to work around the broken script is not ideal. Unlike shebangs that behavior is standardized. Which is what I consider ideal. Thanks for your input

Re: ./script doesn't work in completion function

2024-01-22 Thread Greg Wooledge
On Mon, Jan 22, 2024 at 12:17:12PM +0200, Oğuz wrote: > On Monday, January 22, 2024, Martin D Kealey > wrote: > > > > You seem to have created an invalid executable. It seems that scripts > > without a #! can only be run with help from the debugger library > > > > Hi Martin, POSIX shells interpre

Re: ./script doesn't work in completion function

2024-01-22 Thread Oğuz
On Monday, January 22, 2024, Martin D Kealey wrote: > > You seem to have created an invalid executable. It seems that scripts > without a #! can only be run with help from the debugger library > Hi Martin, POSIX shells interpret such executables as shell scripts, I don't think bash would take a h

Re: ./script doesn't work in completion function

2024-01-22 Thread Grisha Levit
On Mon, Jan 22, 2024, 01:54 Martin D Kealey wrote: > You seem to have created an invalid executable. It seems that scripts > without a #! can only be run with help from the debugger library; That's not quite what happens. These scripts get executed by forking the current bash process (without e

Re: ./script doesn't work in completion function

2024-01-21 Thread Martin D Kealey
Hi Oğuz On Sun, 21 Jan 2024 at 03:20, Oğuz wrote: > $ echo echo foo bar >s > $ chmod +x s > You seem to have created an invalid executable. It seems that scripts without a #! can only be run with help from the debugger library; for example, this is what I get when I run up bash_5.1.3p47

./script doesn't work in completion function

2024-01-20 Thread Oğuz
See: $ echo echo foo bar >s $ chmod +x s $ f(){ COMPREPLY=($(bash ./s));} $ complete -F f g $ $ g bar foo $ g ^C $ $ f(){ COMPREPLY=($(./s));} $ g ^C^C $ I press tab after typing `g ' in both cases, this moves the cursor to the right in