Re: Space as a key in an associative array - different behaviours
On 1/25/18 3:45 PM, Chet Ramey wrote: > These two commands are basically equivalent. By the time the expression > evaluation is performed, the expression has undergone word expansion, > and the expression is "A[ ]++" or "A[ ]=1", respectively. Bash doesn't > allow blank array subscripts, and when the expression evaluator tries to > get the value of "A[ ]", it's not seen as a valid array reference. > > (It should display an error message if it's not going to allow it, though.) The alternative, of course, is to simply allow subscripts consisting only of whitespace: they would evaluate to 0 in an arithmetic context and as a string when subscripting associative arrays. I'll look at this. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
Feature request: tab completion on functions
I have some functions that are very similar and would like to be able to tabcomplete those. The command is like makeFoodSpaghetti and makeFoodLasagne. I get tabcompletion for make but if the nextletter isn't a capital letter it doesn't work and obviously need to have capital letter for S and L as well. I've already set the set completion-ignore-case on in the .inputrc, but it seems this doesn't take effect on the first word...
Re: Feature request: tab completion on functions
On 1/26/18 5:57 AM, Odne Hellebø wrote: > I have some functions that are very similar and would like to be able to > tabcomplete those. The command is like makeFoodSpaghetti and > makeFoodLasagne. I get tabcompletion for make but if the nextletter isn't a > capital letter it doesn't work and obviously need to have capital > letter for S and L as well. You want to be able to complete shell function names case-insensitively even though you won't be able to execute the result? I can see case- insensitivity for executables on a case-insensitive file system like Mac OS HFS+ or APFS, but shell functions? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
Re: Feature request: tab completion on functions
On 26.1. 16:36, Chet Ramey wrote: You want to be able to complete shell function names case-insensitively even though you won't be able to execute the result? I can see case- insensitivity for executables on a case-insensitive file system like Mac OS HFS+ or APFS, but shell functions? Doesn't Bash/readline already tab-complete file names so that the completion fixes the case? If I do 'touch ABBA' and 'rm ab', it will complete the name to 'ABBA'. It also completes 'ab' to 'ABBA' as the name of a command if it's a binary in PATH, but if it's a function, it seems to require the correct case. Sort of confusing, really. -- Ilkka Virta / itvi...@iki.fi
Fwd: coproc FDs (file descriptors) available to subshells
Ping :) -- Forwarded message -- From: Tadeus Prastowo Date: Wed, Jan 24, 2018 at 7:52 PM Subject: Re: coproc FDs (file descriptors) available to subshells To: chet.ra...@case.edu Cc: bug-bash@gnu.org On Wed, Jan 24, 2018 at 7:32 PM, Tadeus Prastowo wrote: > On Wed, Jan 24, 2018 at 5:51 PM, Tadeus Prastowo > wrote: >> On Wed, Jan 24, 2018 at 3:55 PM, Tadeus Prastowo >> wrote: [...] >>> Okay, I will propose a patch. >> >> diff --git a/doc/bashref.texi b/doc/bashref.texi >> index c0f4a2f..fee8f0e 100644 >> --- a/doc/bashref.texi >> +++ b/doc/bashref.texi >> @@ -1197,7 +1197,10 @@ This pipe is established before any >> redirections specified by the >> command (@pxref{Redirections}). >> The file descriptors can be utilized as arguments to shell commands >> and redirections using standard word expansions. >> -The file descriptors are not available in subshells. >> +The file descriptors are not available in subshells other than those >> +created by command and process substitutions (see the descriptions >> +the substitutions in @ref{Command Substitution} and >> +@ref{Process Substitution}, respectively). >> >> The process ID of the shell spawned to execute the coprocess is >> available as the value of the variable @env{NAME}_PID. >> @@ -3025,6 +3028,12 @@ shell's parent, and traps ignored by the shell >> are ignored >> A command invoked in this separate environment cannot affect the >> shell's execution environment. >> >> +Command substitution and process substitution are invoked in a >> +separate execution environment that starts as an exact duplicate of >> +the execution environment of the shell. As before, any command within >> +the separate execution environment cannot affect the shell's execution >> +environment. >> + >> Command substitution, commands grouped with parentheses, >> and asynchronous commands are invoked in a >> subshell environment that is a duplicate of the shell environment, > > I think the patch misses some information. Please find attached the > new patch that I propose. What do you think? Sorry, the patch still misses some information as per https://lists.gnu.org/archive/html/bug-bash/2011-04/msg00056.html. I attach the updated patch. What do you think? Thank you. -- Best regards, Tadeus patch Description: Binary data
Re: Feature request: tab completion on functions
On 1/26/18 10:23 AM, Ilkka Virta wrote: > On 26.1. 16:36, Chet Ramey wrote: >> You want to be able to complete shell function names case-insensitively >> even though you won't be able to execute the result? I can see case- >> insensitivity for executables on a case-insensitive file system like >> Mac OS HFS+ or APFS, but shell functions? > > Doesn't Bash/readline already tab-complete file names so that the > completion fixes the case? If I do 'touch ABBA' and 'rm ab', it will > complete the name to 'ABBA'. It also completes 'ab' to 'ABBA' as the > name of a command if it's a binary in PATH, but if it's a function, it > seems to require the correct case. Sort of confusing, really. Well, let's look at it. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
Re: Fwd: coproc FDs (file descriptors) available to subshells
On Fri, Jan 26, 2018 at 5:08 PM, Chet Ramey wrote: > On 1/26/18 10:56 AM, Tadeus Prastowo wrote: >> Ping :) > > I'll add something in the next devel branch push. Thank you in advance for fixing Bash doc. Have a nice weekend! > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/ -- Best regards, Tadeus
Re: Feature request: tab completion on functions
@Chet why wouldn't I be able to execute the result? @Ilkka Virta you nailed it :) I may have been slightly unclear on what I want. I have 2 functions makeFoodSpaghetti and makeFoodLasagne. * ma * makeFood * makeFoodl <- this does nothing * makeFoodL-> expands to makeFoodLasagne So I want to be able to write the lowercase l after makeFood and tab complete to get the function that I want. Did a quick test with scripts and that works. On 26 January 2018 at 17:14, Chet Ramey wrote: > On 1/26/18 10:23 AM, Ilkka Virta wrote: > > On 26.1. 16:36, Chet Ramey wrote: > >> You want to be able to complete shell function names case-insensitively > >> even though you won't be able to execute the result? I can see case- > >> insensitivity for executables on a case-insensitive file system like > >> Mac OS HFS+ or APFS, but shell functions? > > > > Doesn't Bash/readline already tab-complete file names so that the > > completion fixes the case? If I do 'touch ABBA' and 'rm ab', it will > > complete the name to 'ABBA'. It also completes 'ab' to 'ABBA' as the > > name of a command if it's a binary in PATH, but if it's a function, it > > seems to require the correct case. Sort of confusing, really. > > Well, let's look at it. > > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/ >