Re: Changing the way bash expands associative array subscripts

2021-03-30 Thread konsolebox
a=(["\$(echo foo)"]="1" [foo]="3" ) > declare -A a=([foo]="3" ) > declare -A a=() As I've observed, in single expansion mode, unset will fail to unset a value when the key has a closing bracket in it. Perhaps unset should check the last character first when looking for the closing bracket. Tested in 5.1.4. -- konsolebox

Re: select syntax violates the POLA

2021-04-01 Thread konsolebox
separate from the first class syntax. Bash is not C or Go and shouldn't be written like it. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-01 Thread konsolebox
On Fri, Apr 2, 2021 at 2:56 AM Chet Ramey wrote: > > On 4/1/21 2:55 PM, konsolebox wrote: > > > So to keep compatibility, would this be the right way? > > > > if [[ BASH_VERSINFO -ge 6 || BASH_VERSINFO -eq 5 && BASH_VERSINFO -ge 2 ]]; > >

Re: Changing the way bash expands associative array subscripts

2021-04-01 Thread konsolebox
On Fri, Apr 2, 2021 at 3:02 AM konsolebox wrote: > > On Fri, Apr 2, 2021 at 2:56 AM Chet Ramey wrote: > > > > On 4/1/21 2:55 PM, konsolebox wrote: > > > > > So to keep compatibility, would this be the right way? > > > > > > if [[ BASH_VERSINFO

Re: select syntax violates the POLA

2021-04-02 Thread konsolebox
t; rule. > > The right question would be why '} else' works. Indeed. This inconsistency should be fixed and prevent people from using it wrong. `}; else` should work but not `} else` just like how `{ :; } :` doesn't. -- konsolebox

Re: select syntax violates the POLA

2021-04-02 Thread konsolebox
reserved words themselves just like () and {} as they can be used multi-line but they aren't allowed to be adjacent to else et al without a semicolon. [[ ]], (( )), {}, and () are practically just commands with first-class parsing that consistently have to end with a semicolon if followed by another reserved word or command. -- konsolebox

Re: select syntax violates the POLA

2021-04-04 Thread konsolebox
with them as well. This should have been explicitly allowed by the shell. It's highly doable even if they are followed with non-keywords. Just look at awk's syntax. -- konsolebox

Re: select syntax violates the POLA

2021-04-04 Thread konsolebox
2150. They are labeled as "Reserved words". -- konsolebox

No such device or address when opening /dev/fd/ on opened /dev/tcp socket

2021-04-05 Thread konsolebox
s like this does the same: # echo a | tee /dev/fd/4 4>/dev/tcp/host/port # echo a | ( tee /dev/fd/4 ) 4>/dev/tcp/host/port The workaround is to use process substitution and cat: # echo a | tee >( cat > /dev/tcp/host/port ) Tested in 5.1.4. -- konsolebox

Re: No such device or address when opening /dev/fd/ on opened /dev/tcp socket

2021-04-05 Thread konsolebox
gt;/dev/tcp/host/port' Nice strategies. -- konsolebox

Re: No such device or address when opening /dev/fd/ on opened /dev/tcp socket

2021-04-05 Thread konsolebox
doesn't generate that error on macOS, for instance, which has /dev/fd. Thanks. I'll take note of it for future reference. -- konsolebox

Empty array referenced by indirection reports unbound variable

2021-04-05 Thread konsolebox
le functions to have less versions. The detection of unbound variables seem to have become more reasonable since 5.0 and I hope it gets improved further. I don't use set -u in older bash and it's only for development mode. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-05 Thread konsolebox
On Mon, Apr 5, 2021 at 9:44 PM Chet Ramey wrote: > > On 4/1/21 3:02 PM, konsolebox wrote: > > >> To do what, exactly? > > > > To keep this working in both behaviors. > > > > declare -A a > > key='$(echo foo)' > > a[$key]=1 > &

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread konsolebox
On Tue, Apr 6, 2021 at 9:57 PM Alex fxmbsw7 Ratchev wrote: > > arr=( ) implies no [0]= arr[0] is not exactly being referenced here. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread konsolebox
On Tue, Apr 6, 2021 at 9:57 PM Alex fxmbsw7 Ratchev wrote: > > arr=( ) implies no [0]= Also `arr=()` does not imply `arr[0]=`. `arr[0]` remains unset and not assigned to any. Not even an empty string. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread konsolebox
verything or nothing. Unbound variable errors should not apply to it. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread konsolebox
d don't expand the referenced target themselves. ${!__ref} is synonymous to ${array[@]}, not ${${array[@]}}. This is why you can do other parameter expansion features like ${!var+.} ${!var@a}. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-06 Thread konsolebox
of the arguments of the `unset' builtin is the cleanest way > to solve the problem of `key=@; unset -v a[$key]'. Or maybe just completely avoid this new behaviors and allow another way to unset an element of an array. a[$key]=() a[@]=() I think a shell already does this. Not sure if it's from ksh, zsh, or pdksh. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-06 Thread konsolebox
On Wed, Apr 7, 2021 at 12:20 AM Ilkka Virta wrote: > What konsolebox said about a[$k]=() works in my Zsh for indexed arrays, but > not associative ones. > (It replaces an array slice, so can also be used to insert elements in the > middle.) Bash can adopt this. Also if Bash coul

Re: Changing the way bash expands associative array subscripts

2021-04-06 Thread konsolebox
the clearest example I can give is Java's LinkedHashMap. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-04-07 Thread konsolebox
On Wed, Apr 7, 2021 at 9:25 PM Chet Ramey wrote: > > On 4/5/21 4:45 PM, konsolebox wrote: > > set -u > > array=() > > __ref=array[@] > > : "${array[@]}" # Reports nothing > > This is a special case, mirroring the special case that POSIX carved

Re: Empty array referenced by indirection reports unbound variable

2021-04-07 Thread konsolebox
rrayref = 1; + } +} + else if (valid_array_reference (name, 0)) { int qflags; char *t; -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-08 Thread konsolebox
On Fri, Apr 9, 2021 at 2:19 AM Chet Ramey wrote: > What is your end goal? To run the same script on different versions of > bash, or something else? Nevermind. I overthinked. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-08 Thread konsolebox
On Fri, Apr 9, 2021 at 3:21 AM Chet Ramey wrote: > > On 4/6/21 11:42 AM, konsolebox wrote: > > > Or maybe just completely avoid this new behaviors and allow another > > way to unset an element of an array. > > > > a[$key]=() > > a[@]=() > > While thi

Re: Changing the way bash expands associative array subscripts

2021-04-08 Thread konsolebox
king internal sanity checks. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-08 Thread konsolebox
On Fri, Apr 9, 2021 at 8:17 AM konsolebox wrote: > It's a definite shell feature despite lacking internal sanity checks. *despite having limited -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-09 Thread konsolebox
my_function { local my_function__a another_function my_function__a } This solution applies to namerefs, indirections and evil eval. Keeping the passed references sane is up to the scripter. -- konsolebox

Re: When "set -u", "which" outputs environment: line 1: _declare: unbound

2021-04-09 Thread konsolebox
s or external commands is a function. Try `type which`. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-13 Thread konsolebox
ak scripts. The only change I'd want is have `unset 'a[@]'` only unset the elements and not the array itself. -- konsolebox

Re: Changing the way bash expands associative array subscripts

2021-04-15 Thread konsolebox
On Fri, Apr 16, 2021 at 12:10 AM Chet Ramey wrote: > > I actually agree with konsolebox that assoc_expand_once for unset > > shouldn't be defaulted. The option `assoc_expand_once' is incomplete > > in the sense that the behavior of `a[@]' and `a[*]' are

Re: Changing the way bash expands associative array subscripts

2021-04-18 Thread konsolebox
t going to go that way without much better reasons than I've seen > so far. There's less reason to choose a complicated solution that adds thinking overhead, adds inconsistencies and breaks scripts. Making unset skip default word expansion on tokens that pass valid_array_reference () is much simpler. -- konsolebox

[PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread konsolebox
also available in https://github.com/konsolebox/bash/tree/skip_expansion_of_valid_array_refs_in_unset. The patch is applied against the latest commit (f3a35a2d60) in master branch. The changes can be conveniently compared in https://git.io/JOgrE. The solution allows the following tests to pass. A

[PATCH] Free unfreed string in assign_assoc_from_kvlist()

2021-04-19 Thread konsolebox
aval = (char *)xmalloc (1); aval[0] = '\0'; /* like do_assignment_internal */ - free_aval = 1; } bind_assoc_var_internal (var, h, akey, aval, flags); - if (free_aval) - free (aval); + free (aval); } } -- konsolebox

Re: [PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread konsolebox
unsigned int flags; /* Flags associated with this word. */ > `y.tab.c' is automatically generated from `parse.y'. You should edit > `parse.y' instead of `y.tab.c' I also modified parse.y. All changes made so far can be seen in https://git.io/JOam0. Thanks for the tips. -- konsolebox

Re: [PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread konsolebox
I'll just skip that as I would also have to modify other declarations for consistency. I think the code is already good enough for a proof of concept at least. -- konsolebox

Add {{ }}, ${{ }}, return n [x], and $:

2021-04-29 Thread konsolebox
global variable when unsetting an iterator in an initialization script to keep the variables clean, even just by theory. -- konsolebox

Re: Add {{ }}, ${{ }}, return n [x], and $:

2021-04-30 Thread konsolebox
On Fri, Apr 30, 2021 at 4:09 PM Robert Elz wrote: > > Date:Fri, 30 Apr 2021 14:53:58 +0800 > From:konsolebox > Message-ID: > > > | {{ }} - Similar to { }, but runs like a function so variables can be > | declared local > > From

Allow `read` to recognize custom completions

2021-05-22 Thread konsolebox
utocomplete the commands that are accepted. Perhaps adding a shell option that enables this or another option to read like -E would be sensible. -- konsolebox

Re: Allow `read` to recognize custom completions

2021-06-01 Thread konsolebox
On Tue, May 25, 2021 at 4:36 AM Chet Ramey wrote: > > On 5/22/21 8:29 AM, konsolebox wrote: > > `read -e` doesn't recognize custom completions (at least on my basic > > observations). For example, if I enable `complete -IW 'someword > > another-word'`,

Re: Allow `read` to recognize custom completions

2021-06-15 Thread konsolebox
On Wed, Jun 2, 2021, 10:27 konsolebox, wrote: > On Tue, May 25, 2021 at 4:36 AM Chet Ramey wrote: > > > > On 5/22/21 8:29 AM, konsolebox wrote: > > > `read -e` doesn't recognize custom completions (at least on my basic > > > observations). For exampl

Space vs. non-space separators in COMP_WORDBREAKS

2021-12-16 Thread konsolebox
n't spaces are also passed as an argument and stored in COMP_WORDS. This surprised me a bit, and I think it would be helpful if this behavior gets documented as well. Tested with 5.1.12. -- konsolebox

Have a method to prevent space from being added after an invalid one-result completion

2021-12-17 Thread konsolebox
t appearing in the completions. -- konsolebox

Re: Have a method to prevent space from being added after an invalid one-result completion

2021-12-17 Thread konsolebox
Nevermind I found a way. The trick is to enable nospace by default and add space manually to only result when result is 1 and is valid. -- konsolebox

Re: Space vs. non-space separators in COMP_WORDBREAKS

2021-12-17 Thread konsolebox
nce on how a separator is kept like rl_special_prefixes but none of them seems to have anything to do with the space character. -- konsolebox

Re: Space vs. non-space separators in COMP_WORDBREAKS

2021-12-17 Thread konsolebox
On Fri, Dec 17, 2021 at 7:13 PM Chet Ramey wrote: > > On 12/17/21 2:00 PM, konsolebox wrote: > > On Sat, Dec 18, 2021, 00:49 Chet Ramey, wrote: > >> Well, the documentation says the line gets broken into words the way > >> readline does it, and r

Feature Request: Allow each completion to have their own wordbreaks

2021-12-18 Thread konsolebox
ociative array variable that can contain the name of the completion as the key and the value as the word break characters. -- konsolebox

Re: Zero-length indexed arrays

2021-12-22 Thread konsolebox
On Wed, Dec 22, 2021 at 4:07 AM Greg Wooledge wrote: > I would recommend not using set -u. > Especially > when you need to support multiple bash versions, or even multiple shells. It's still useful during development stages. -- konsolebox

Re: Space vs. non-space separators in COMP_WORDBREAKS

2021-12-22 Thread konsolebox
ds to be documented. It makes use of a single parameter but interprets its values differently. Anyway at least I now know the behavior is intended, so I don't really mind how this goes. -- konsolebox

Re: Add {{ }}, ${{ }}, return n [x], and $:

2021-12-27 Thread konsolebox
To Chet: Any thoughts on this? -- konsolebox

Re: Add {{ }}, ${{ }}, return n [x], and $:

2021-12-27 Thread konsolebox
cripts more portable, which means other > implementors > are under no pressure to copy the feature...Implemented optimisations > for the standard shell syntax simply work, and improve performance, while > still allowing the script to work anywhere. > I'm not really concerned about portability for this. Bash has always made its own fruitful implementations. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-12-27 Thread konsolebox
On Thu, Apr 8, 2021, 06:56 konsolebox, wrote: > On Thu, Apr 8, 2021 at 2:44 AM Chet Ramey wrote: > > Indirection does not check whether or not the variable it's indirecting > > is $@/$* or ${array[@/*]}. It simply goes by the return value. > > It looks like it can

Re: Allow `read` to recognize custom completions

2021-12-27 Thread konsolebox
On Mon, Jun 21, 2021, 23:34 Chet Ramey, wrote: > On 6/16/21 2:04 AM, konsolebox wrote: > > > Thanks, that worked well. Is there a chance a feature that would > > allow this be defaulty implemented in the next version? If yes, what > > would be the strategy

Re: Empty array referenced by indirection reports unbound variable

2021-12-30 Thread konsolebox
On Thu, Dec 30, 2021 at 4:35 PM Chet Ramey wrote: > > On 12/27/21 11:37 PM, konsolebox wrote: > > On Thu, Apr 8, 2021, 06:56 konsolebox, > <mailto:konsole...@gmail.com>> wrote: > > > > On Thu, Apr 8, 2021 at 2:44 AM Chet Ramey >

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread konsolebox
ogether with Chet's and Greg's mail; All around good and > reasonable things said by people I trust to say sensible things about > the shell. Thanks. I'll stand down from my "you need to do something > right now" position. > > Take care, > As for me whatever it is, it should be done consistently and with no compromise. No matter how "slightly broken" it is or no matter unlikely it is to occur it should be fixed. Post filename expansion or population processes should not make any interpretation of the expanded filenames in whatsoever manner. -- konsolebox

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread konsolebox
On Tue, Jan 25, 2022, 06:24 Robert Elz, wrote: > Date:Tue, 25 Jan 2022 05:45:23 +0800 > From: konsolebox > Message-ID: < > cajnmqwbvrbdijqcu8+oo0gvic7onew8nkv4djfyy3o5eepm...@mail.gmail.com> > > | As for me whatever it is, it should be done

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread konsolebox
ta that is needed. > That would be reasonable, the \x nonsense (the PSx escapes) aren't. Thanks for the details. I at least agree with not using \w and \W here if anyone wants to escape literal escape sequences, or wait till bash adds a generous feature that escapes any valid terminal code. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2022-02-06 Thread konsolebox
On Thu, Dec 30, 2021 at 4:35 PM Chet Ramey wrote: > Let's try it. Thanks for the report. It seems to be already fixed in 5.2-alpha (thanks), but I can't see it mentioned in the changelog. Can you kindly confirm if it really is? -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2022-02-06 Thread konsolebox
On Mon, Feb 7, 2022, 00:31 Chet Ramey, wrote: > From CHANGES: > > ... Well I'm glad. Thanks again! -- konsolebox

5.2-alpha completion script source crash

2022-02-19 Thread konsolebox
ns it and exits well. Compiling it with a safer flag like `-ggdb3 -O -pipe` didn't help. -- konsolebox

Feature Request: Allow compgen to store results on a variable

2022-02-20 Thread konsolebox
Commonly `readarray -t`, a pipe, and a subshell is used to get the results of compgen but this has two problems: - It uses a pipe and a subshell - Values having newlines will be split Those can be prevented if another option is added. E.g.: compgen -O array_var ... -- konsolebox

Feature Request: Add option to make completed values always become properly escaped

2022-02-20 Thread konsolebox
be properly quoted, this manual quoting hacks wouldn't be needed. -- konsolebox

Re: Feature Request: Add option to make completed values always become properly escaped

2022-02-25 Thread konsolebox
lash to the result when the result matches a directory. For example, "test" which refers to a task becomes "test/". -- konsolebox

Re: Feature Request: Add option to make completed values always become properly escaped

2022-02-25 Thread konsolebox
On Fri, Feb 25, 2022 at 8:29 AM konsolebox wrote: > What I need more is an option that allows replacing the current > word including the quote (', ", or $') that begins it with the result > as is rather than appending the result to the quote. ... because the result is alr

Re: Feature Request: Add option to make completed values always become properly escaped

2022-02-26 Thread konsolebox
On Fri, Feb 25, 2022 at 2:46 PM Chet Ramey wrote: > > On 2/25/22 3:29 AM, konsolebox wrote: > > On Mon, Feb 21, 2022 at 4:32 PM Chet Ramey wrote: > >> What does `properly quoted' mean here and how does it differ from the > >> quoting you get when you force c

Re: Feature Request: Add option to make completed values always become properly escaped

2022-03-09 Thread konsolebox
On Mon, Mar 7, 2022, 23:16 Chet Ramey, wrote: > On 2/26/22 2:01 PM, konsolebox wrote: > > > I think an option like 'escape' that simply escapes COMPREPLY > > values when used for completion and doesn't compare it to existing > > filesystem objects will be

5.2-alpha prompt broken on next line

2022-03-21 Thread konsolebox
ckspace to be typed to be triggered. I can't reproduce it with 5.1.4 and 5.1.16. All tested versions have their bundled readlines compiled with them. -- konsolebox

Re: 5.2-alpha prompt broken on next line

2022-03-21 Thread konsolebox
On Mon, Mar 21, 2022 at 7:11 PM Chet Ramey wrote: > Isn't this the same as > > https://lists.gnu.org/archive/html/bug-readline/2022-02/msg00038.html ? > > That's already fixed. I'm sorry I didn't check. Yes it's already fixed. -- konsolebox

Re: 5.2-alpha completion script source crash

2022-03-21 Thread konsolebox
On Sat, Feb 19, 2022 at 9:34 PM Chet Ramey wrote: > Thanks for the report. This is the result of needing to clean up parser > state before recursively calling it to parse the command substitution. Just tested devel. This one's fixed as well. -- konsolebox

Re: Feature request

2022-07-22 Thread konsolebox
ction name is same as script) or 'utils..' since the dot is allowed in Bash. For the global variables used in each script, I have them all capitalized and prefixed with the name of the "namespace", like "UTILS__". It risks conflict with global and builtin variables but adds easy distinguishability vs. just using lowercase letters prefixed with an underscore. Optionally an underscore can be prefixed to avoid the conflict but I haven't really needed it so far besides on a few shared (just, probably) ones. I also do have an extended "include" function that accepts wildcards best used for loading dynamic yet managed sub-scripts. -- konsolebox

New instances of Bash should ignore and reset BASH_ARGV0

2022-10-09 Thread konsolebox
This doesn't look right to me: # export BASH_ARGV0=fdsafasfas # bash # echo "$BASH_ARGV0|$0" fdsafasfas|fdsafasfas # echo $BASH_VERSION 5.2.0(1)-release -- konsolebox

Re: Allow `read` to recognize custom completions

2023-09-02 Thread konsolebox
On Mon, Jun 21, 2021 at 11:34 PM Chet Ramey wrote: > I'll consider it. It's low priority right now. Hello Chet, I just saw this implemented in 5.3. Just want to say thanks a lot!! I extremely appreciate it. -- konsolebox

Re: Feature Request: Allow compgen to store results on a variable

2023-09-02 Thread konsolebox
On Mon, Feb 21, 2022 at 2:23 AM konsolebox wrote: > > Commonly `readarray -t`, a pipe, and a subshell is used to get the > results of compgen but this has two problems: > > - It uses a pipe and a subshell > - Values having newlines will be split > > Those can be preven

Bash crashes with trapped SIGCHLD and read -t.

2013-01-24 Thread konsolebox
Hi. Is there a way to prevent this segmentation fault in Bash? I'm not sure where the fault happens but when there's a function that handles a trap and when a signal is caught during a session of read with -t, Bash crashes. An example code that makes this happen is this: #!/b

Re: Bash crashes with trapped SIGCHLD and read -t.

2013-01-24 Thread konsolebox
at 12:28 AM, Chet Ramey wrote: > On 1/24/13 8:35 AM, konsolebox wrote: > > Hi. Is there a way to prevent this segmentation fault in Bash? I'm not > sure > > where the fault happens but when there's a function that handles a trap > and > > when a signal is cau

Re: Bash crashes with trapped SIGCHLD and read -t.

2013-01-24 Thread konsolebox
> > This doesn't help a lot. How about building bash-4.2.42 with -g so > debugging symbols are preserved, then seeing where the crash is? > I compiled 4.2.42 using gcc 4.6.3 (C[XX]FLAGS="-march=native -O2 -g"). It took longer before the crash occurred and this is the report I got: malloc: ./read

Re: Bash crashes with trapped SIGCHLD and read -t.

2013-01-24 Thread konsolebox
> OK. What version of Linux are you using? Maybe I have that and will be > able to reproduce it more easily. > > Chet > Gentoo, but it happens in Slackware as well. Ubuntu too I think.

Re: Bash crashes with trapped SIGCHLD and read -t.

2013-01-24 Thread konsolebox
> OK. What version of Linux are you using? Maybe I have that and will be > able to reproduce it more easily. > > Chet > Oh sorry, if you mean the kernel version it's 3.4.10-tuxonice in Gentoo but it happens in most if not all kernels I used. Glibc version is 2.15-r2.

Re: Bash crashes with trapped SIGCHLD and read -t.

2013-01-25 Thread konsolebox
I really appreciate that. Thank you very much :) My software would finally work in a loop with no worries. OK, I was able to figure it out. The problem is that the `read -t' > generates SIGALRM, which sometimes arrives and is handled while the SIGCHLD > trap is running (bash-4.2 runs the SIGCHLD

Re: setvalue builtin command

2013-04-04 Thread konsolebox
Hi. I made a post on this before but I haven't got a reply. I actually want to know what people think about the idea as I actually find a command like this really helpful. Anyone please? On Wed, Feb 6, 2013 at 11:30 AM, konsolebox wrote: > Hi. I was wondering if we could add a builtin

Re: setvalue builtin command

2013-04-04 Thread konsolebox
On Thu, Apr 4, 2013 at 3:26 PM, Dan Douglas wrote: > On Wednesday, April 03, 2013 11:53:48 PM konsolebox wrote: > > Hi. I made a post on this before but I haven't got a reply. I actually > want > > to know what people think about the idea as I actually find a command

Re: setvalue builtin command

2013-04-04 Thread konsolebox
> > Another "feature" of this kind of construct is that you can put the name > of the variable-to-be-assigned into another variable: > > ptr=some_variable > setvalue "$ptr" "$foo" > > Which may be a good thing or a bad thing, but either way it's definitely > a thing that someone will (ab)use if it'

Re: setvalue builtin command

2013-04-04 Thread konsolebox
On Thu, Apr 4, 2013 at 8:51 PM, konsolebox wrote: > Another "feature" of this kind of construct is that you can put the name >> of the variable-to-be-assigned into another variable: >> >> ptr=some_variable >> setvalue "$ptr" "$foo" >&

Re: setvalue builtin command

2013-04-04 Thread konsolebox
On Thu, Apr 4, 2013 at 9:21 PM, Greg Wooledge wrote: > imadev:~$ stuffit() { declare -n array="$1"; array[thing]=foobar; } Checked my test script and I actually added -A to declare in the process sorry. It's working now thanks. Ross

Re: setvalue builtin command

2013-04-04 Thread konsolebox
/ci/377ccc3307bdb617ecdc4643acbde5329001e0b3/tree/source/assume.sh http://sourceforge.net/p/playshell/code/ci/377ccc3307bdb617ecdc4643acbde5329001e0b3/tree/source/log.sh This we could do if we have a builtin-level function. On Thu, Apr 4, 2013 at 8:51 PM, konsolebox wrote: > Another "fe

Re: setvalue builtin command

2013-04-09 Thread konsolebox
On Mon, Apr 8, 2013 at 9:05 PM, Greg Wooledge wrote: > On Fri, Apr 05, 2013 at 09:15:10AM +0800, konsolebox wrote: > > The only thing left here is that we can't have error control like when we > > are to create generally shared library scripts e.g.: > >

Re: prevent ignore SIGINT for asynchronous commands without enabling job control

2013-04-10 Thread konsolebox
It's actually simple with trap. Just catch SIGINT with a function and call a function to kill the tree: https://www.linuxquestions.org/questions/blog/konsolebox-210384/bash-functions-to-list-and-kill-or-send-signals-to-process-trees-34624/ Note killtree3. And that could be merged as one s

Re: prevent ignore SIGINT for asynchronous commands without enabling job control

2013-04-11 Thread konsolebox
problem. I thought I should just say this just in case you did used them. Ross On Wed, Apr 10, 2013 at 9:00 PM, konsolebox wrote: > It's actually simple with trap. Just catch SIGINT with a function and call > a function to kill the tree: > > > https://www.linuxquestions.o

Bash 4.3 no longer handles traps when reading input with read

2013-10-10 Thread konsolebox
Good day, It seems like starting 4.3 (beta2) bash already delays handling traps until read exits. Is this intended? It would be a problem if read has a long timeout or doesn't have a timeout at all:

Re: Bash 4.3 no longer handles traps when reading input with read

2013-10-10 Thread konsolebox
wait done And the trap is always called every after 5 seconds when input already times out: sleeping. reading. caught. -- waiting. sleeping. reading. caught. -- waiting. sleeping. reading. ... Cheers, konsolebox On Fri, Oct 11, 2013 at 2:47 PM, konsolebox wrote: > Good day, > >

Re: Bash 4.3 no longer handles traps when reading input with read

2013-10-11 Thread konsolebox
e-key input there's an easy workaround with it through loops with 1-second interval which doesn't really affect my program but it would be a problem to scripts that read user input line by line. SIGCHLD is really a very useful signal so I hope it would be reconsidered. Cheers, konsolebox

Re: Bash 4.3 no longer handles traps when reading input with read

2014-02-18 Thread konsolebox
On Mon, Oct 14, 2013 at 2:29 AM, Chet Ramey wrote: > On 10/11/13 6:19 PM, konsolebox wrote: > > On Fri, Oct 11, 2013 at 10:06 PM, Chet Ramey > <mailto:chet.ra...@case.edu>> wrote: > > > > The SIGCHLD handler was particularly bad, since children can die

Re: Bash 4.3 no longer handles traps when reading input with read

2014-03-03 Thread konsolebox
On Wed, Feb 19, 2014 at 11:01 PM, Chet Ramey wrote: > On 2/19/14 1:51 AM, konsolebox wrote: > > > Bash-4.3 handles signals and traps when a read run by the read > builtin is > > interrupted by a signal. I'm not sure that's the best thing to do, > >

Re: Bash 4.3 no longer handles traps when reading input with read

2014-03-03 Thread konsolebox
Just added correction: On Mon, Mar 3, 2014 at 8:47 PM, konsolebox wrote: > echo "Interacting." > > until read -t 1; do > continue > done > I actually modified that part as well. Results are similar even if not in a loop: echo "Interacting." > >

add a way to declare global variables

2009-12-10 Thread konsolebox
y but through the said functions. I hope the development team will also consider adding a way in bash to declare global variables inside a function perhaps either with an option in typeset or declare like -g (same as zsh) and/or a builtin function like global as similar to local. Cheers, konsolebox

Parameter indirection

2018-07-15 Thread konsolebox
just refers to expanding a variable. An official note in this mailing list that it won't change if intended may also help. Cheers, konsolebox

Re: test -v and environment variable names with subscripts

2018-07-19 Thread konsolebox
On Wed, Jul 18, 2018 at 5:19 AM, Grisha Levit wrote: > $ set -u; unset var; f() { test -v 'var[0]'; echo $?; }; var[0]=X f > 0 > -bash: var[0]: unbound variable I'm not getting this error. What version of bash are you using? -- konsolebox

Re: Parameter indirection

2018-07-24 Thread konsolebox
gt; the `parameter' in ${[!]parameter[op[word]]}. If you think it would read > more clearly if I used `parameter' instead of `variable', I can look at > doing that. I just saw the update in the devel branch. Thanks a lot! -- konsolebox

Assignment of associative arrays through braces

2018-07-27 Thread konsolebox
/konsolebox/bash/tree/assoc_array_brace_assign. Besides having an easy way to define associative arrays, this feature would also allow associative arrays to be used as "return variables". The caller wouldn't have to initialize the associative array unless it wants to have it declared l

Re: Assignment of associative arrays through braces

2018-07-31 Thread konsolebox
On Tue, Jul 31, 2018 at 10:31 PM, Chet Ramey wrote: > On 7/27/18 7:13 PM, konsolebox wrote: >> Hi Chet, >> >> I wonder if you can allow bash to have another syntax to allow simpler >> declaration and/or definition of associative arrays. The changes >> needed t

Add sleep builtin

2018-08-19 Thread konsolebox
]] && enable sleep I have patch attached as file, and also uploaded in https://github.com/konsolebox/bash/tree/builtin_sleep. -- konsolebox commit 14203764a208279d213d2b4c0babf52abca6078b Author: konsolebox Date: Sun Jul 29 07:58:32 2018 +0800 Add sleep as a static builtin that is dis

  1   2   3   >