Re: bash-5.0: problem with variable scoping in posix-mode
On 1/28/19 6:24 PM, Martijn Dekker wrote: > Op 27-01-19 om 22:59 schreef Chet Ramey: >> This is a consequence of a combination of two POSIX features. First, POSIX >> requires assignment statements preceding special builtins to create global >> variables (POSIX has no local variables) that persist in the shell context >> after the special builtin completes. > > Exactly because POSIX has no notion of local variables (but bash does), > I don't think there is anything that requires you to ignore/override > bash local variables in this context. Any fully POSIX-compliant script > will not use local variables, so is not affected either way. I think > that leaves you free to do the logical thing and keep the scope local as > defined by the user. Yes, I think so. This isn't how the discussion from back in May ended up, but I think I will change the posix-mode behavior for the next release. The default bash behavior will stay the same -- having assignments that precede a special builtin persist past its execution is not something we need to carry forward. -- ``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: bash command completion sometime behave erroneously specifically return 0
On 1/28/19 7:16 PM, Hyunho Cho wrote: > Bash Version: 4.4 > Patch Level: 19 > Release Status: release > > Description: > > ## > > bash command completion sometime behave erroneously > almost works correctly but some cases do not work > specifically return 0 when press tab key > > this is the script i have used and i will attach screenshot recording It's likely the command substitution isn't producing any output to store in WORDS. -- ``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: Unexpected delay in using arguments.
On 1/1/19 9:57 PM, Bize Ma wrote: > Chet Ramey (mailto:chet.ra...@case.edu>>) wrote: > > It's in CWRU/CWRU.chlog in the development distributions > > > I am sorry but I have been unable to find either the source code > or the change log, either at the university site or by looking with google. In the development distributions, always available at http://git.savannah.gnu.org/cgit/bash.git/snapshot/bash-devel.tar.gz Or you could just clone the git tree. > > However, I have made some tests. Yes, the deeper internal delay > with arguments have been removed. Running this code > (from https://unix.stackexchange.com/q/462084/265604): I'm going to assume you're running the pre-release distributions on a Linux system where the debugging code in the bash malloc is enabled. When I try timing the entire script on bash-5.0.2 (Mac OS X), adding `time' calls before `f2 "$@"' and `main', I get args = 1 1 function no args yes real: 0.006 2 function yes args yes real: 0.012 3 function yes args no real: 0.012 args = 2 1 function no args yes real: 0.006 2 function yes args yes real: 0.012 3 function yes args no real: 0.013 real: 0.078 real: 0.503 real0m0.529s user0m0.464s sys 0m0.104s which is comparable to ksh93, which produces real0m0.459s user0m0.349s sys 0m0.107s for the entire script. So I'm comfortable saying there's no big performance issue here. Chet -- ``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/