Re: Avoid asterisk expansion when it selects "everything"

2016-04-14 Thread Andreas Schwab
Mike Frysinger writes: > On 14 Apr 2016 09:23, Andreas Schwab wrote: >> Mike Frysinger writes: >> > alternative idea: alias your rm/mv/etc... commands if you're worried >> > about them. it's not uncommon to do in ~/.bashrc or wherever: >> >a

Re: Bash 4.4 SIGINT during command substitution (?) causes borked terminal

2016-05-17 Thread Andreas Schwab
Grisha Levit writes: > My keyboard input is “1234567890”, which produces: > > bash-4.4$ 24580bash: 13679: command not found Probably two processes competing for terminal input. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3

Re: Setting IFS='*' causes bash to freeze on tab completion

2016-07-02 Thread Andreas Schwab
ho "got here";; esac > > doesn't print "got here". The same issue exists for the other glob special characters ? [ ] . Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

a=$* -> crash

2016-07-27 Thread Andreas Schwab
else if (quoted == 0 && ifs_is_set && (pflags & PF_ASSIGNRHS)) + else if (temp != 0 && quoted == 0 && ifs_is_set && (pflags & PF_ASSIGNRHS)) { temp1 = quote_string (temp); free (temp)

Re: Possible Bug in Auto-Complete

2016-08-07 Thread Andreas Schwab
not using external completion scripts. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Re: heap-use-after-free in GNU Bash 4.4.0

2016-09-09 Thread Andreas Schwab
On Sep 09 2016, Franco Costantini wrote: > We tested this issue on Ubuntu 14.04.5 (x86_64) but other configurations > could be affected. To reproduce it, compilation with Address Sanitizer is > required: valgrind also finds the same error. Andreas. -- Andreas Schwab, sch...@linux

Re: Bash 4.4 doesn't compile on GCC 5.2(easy steps to reproduce)

2016-09-16 Thread Andreas Schwab
quot;' > -DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H -I. > -I/hab/pkgs/core/readline/6.3.8/20160729192706/include -I. -I./include Your readline doesn't match. You need to use the bundled library. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Re: Why does bash use xmalloc?

2016-11-06 Thread Andreas Schwab
itself can use, that has nothing to do with the command you ran. There is no way the shell can continue in this situation, if it cannot allocate any memory at all. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "An

Re: Not operator (~) fail on arithmetic expansion.

2016-11-28 Thread Andreas Schwab
r other Bourne type shell > seems to work. In Bash, ~0 means the 0th entry of the directory stack, ie. $PWD. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Filename completion causes doubling of initial ':' character

2016-12-03 Thread Andreas Schwab
mple' Make sure you don't have any custom completion functions (run complete -r) or non-default setting of COMP_WORDBREAKS. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Re: possible in bash?: filter stderr of a prog & send filtered-output out on stderr leaving stdout untouched

2016-12-06 Thread Andreas Schwab
{ $prog 2>&1 >&3 | grep -v "$RE_filt" >&2; } 3>&1 Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

bash variable expansion ${var:+"..."} in here-document removes double quotes

2016-12-07 Thread andreas . luik
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-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share

Re: null pointer deref, segfault

2017-01-24 Thread Andreas Schwab
ne 1 delimited by end-of-file (wanted `0') bash: warning: here-document at line 0 delimited by end-of-file (wanted `$(()())') bash: line 1: warning: here-document at line 1 delimited by end-of-file (wanted `0') bash: warning: here-document at line 0 delimited by end-of-file (wanted

Re: "Variation" in Command Substitution Behaviour

2017-02-28 Thread Andreas Schwab
y:pebbles:barney $ say_families + say_families + echo Flintstones=wilma:bam-bam:fred Flintstones=wilma:bam-bam:fred + echo Rubbles=betty:pebbles:barney Rubbles=betty:pebbles:barney Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."

Re: syntax error with lone > or < as string in [ ] tests with -a or -o operators

2024-04-15 Thread Andreas Schwab
On Apr 15 2024, Greg Wooledge wrote: > And that's a bug. That code is wrong, and it should be written this way > instead: > > [ -z "$var1" ] && [ -z "$var2" ] && continue Or just [ -z "$var1$var2" ] && continue -- And

Re: Examples of concurrent coproc usage?

2024-04-16 Thread Andreas Schwab
nary data doesn't work if you're reading newline-terminated > records, because you cannot store the NUL character in a shell > variable. But you can delimit your records on NULs, and use printf to > reproduce them. Though that will likely add a spurious null at EOF. -- Andreas Schwab,

Re: [Help-bash] difference of $? and ${PIPESTATUS[0]}

2024-04-22 Thread Andreas Kähäri
The exit status of an "if" statement is the exit status of the last command executed within the body of the statement. In your last example, nothing is executed by the body of the "if" statement, so the exit status of the statement is zero. >From the bash manual about this in the "Compound Commands" section: The exit status is the exit status of the last command executed, or zero if no condition tested true. The PIPESTATUS array is set by virtue of executing the "false" command in the "if"-satement's test. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: Linux reports memfd_create() being called without MFD_EXEC or MFD_NOEXEC_SEAL set

2024-04-27 Thread Andreas Schwab
n later kernels, but nevertheless, bash should pass MFD_NOEXEC_SEAL (if defined) when it calls memfd_create. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: bash: ":?xxx" filename broken on autocomplete

2024-04-27 Thread Andreas Schwab
?aa' > # touch 'something-else' > # rmdir : > > ... produces nothing until pressing the tab key a second time, after which > both entries are listed while the content of readline's input buffer remains > unchanged. ':' is in $COMP_WORDBREAKS. -- Andrea

Re: Linux reports memfd_create() being called without MFD_EXEC or MFD_NOEXEC_SEAL set

2024-04-28 Thread Andreas Schwab
On Apr 28 2024, Chet Ramey wrote: > On 4/27/24 8:09 AM, Andreas Schwab wrote: >> On Apr 27 2024, Kerin Millar wrote: >> >>> At some point after upgrading to bash-5.3-alpha, the following message >>> appeared in my kernel ring buffer. >>> >>> [

Re: bug in bash

2024-05-12 Thread Andreas Kähäri
error". Or we can ctrl C. > Version 5.2 > > Kind regards > Quoc Tri do What was it that you intended to do when you composed that command? -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: bug in bash

2024-05-12 Thread Andreas Schwab
from a terminal. Since the redirection fails and the cat command is never started, bash doesn't switch the terminal process group, and the background wc command goes on competing with bash for the terminal. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: bug in bash

2024-05-12 Thread Andreas Schwab
bash switches the terminal process group back before the background process starts reading from the terminal (won't happen in this example since the cat command blocks on reading the process substitution file). -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69

Changed behaviour of ${PARAMETER/#PATTERN/STRING} and ${PARAMETER/%PATTERN/STRING}

2024-05-13 Thread Andreas Schwab
In 5.3-alpha, it is no longer possible to quote the special % and # characters in a pattern replacement expansion. $ a=1/%2/%3 $ echo "${a/\%/##}" 1/%2/%3## $ echo "${a/\/%/##}" 1##2/%3 The second example shows that quoting still works as expected for ${PARAMETER//PATTERN/S

Re: bug in bash

2024-05-14 Thread Andreas Schwab
thing like SIGHUP. But leaving it in the process group of the parent shell does not accomplish that, which is actually the point of this thread. A process substitution is similar to a pipeline; it really belongs to the process group of the command that reads from it. -- Andreas Schwab, SUSE Labs,

Re: [PATCH] globsort: handle int overflow in cmp functions

2024-05-20 Thread Andreas Schwab
is wider than int, it can return a wrong value even if the subtraction doesn't overflow. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-20 Thread Andreas Kähäri
t; > I think this is a really good solution. I hadn't thought of it. > Users can even make an alias to set a default for themselves. > > -- Matheus Or even PATH=${BASH_SEARCH_PATH-$PATH} . file without the need to add any options to . or to source. But maybe that too pedestrian? -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: [PATCH v2 5/8] builtins/source: parse the -i option

2024-05-20 Thread Andreas Kähäri
On Mon, May 20, 2024 at 01:54:20PM -0400, Greg Wooledge wrote: > On Mon, May 20, 2024 at 07:43:10PM +0200, Andreas Kähäri wrote: > > On Mon, May 20, 2024 at 05:31:05PM +, Matheus Afonso Martins Moreira > > wrote: > > > >> Why not add a -p option to &#x

Re: set -a leads to truncated output from ps

2024-06-13 Thread Andreas Schwab
Why do you think this is a bug in bash? You are telling the shell to export any modified variable, and you get what you asked for. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

history-search-backward clobbers history

2024-06-19 Thread Andreas Schwab
4 echo 1234 5 history bash-5.3$ echo 2345 2345 bash-5.3$ history 1 echo 1234 2 echo 2345 3 echo 13456 4 echo 21234 5 history 6 echo 2345 7 history bash-5.3$ exit $ cat history echo 1234 echo 2345 echo 3456 echo 21234 history echo 2345 history -- Andreas S

Re: history-search-backward clobbers history

2024-07-01 Thread Andreas Schwab
which happens to > leave the `echo 3456' unchanged -- coincidentally the first history entry > changed by moving around the history list and editing. So what did change in 5.3 that this is now broken? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4

Re: history-search-backward clobbers history

2024-07-01 Thread Andreas Schwab
On Jul 01 2024, Chet Ramey wrote: > On 7/1/24 3:54 AM, Andreas Schwab wrote: > >> So what did change in 5.3 that this is now broken? > > If you want to report a bug, report one. Be specific about what you > think is wrong and what you think the correct behavior is. The corre

Re: history-search-backward clobbers history

2024-07-01 Thread Andreas Schwab
The wrong thing is that the history contains commands that were never executed: echo 13456 and echo 21234. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: [bug #65981] "bash test -v" does not work as documented with "export KEY="

2024-07-12 Thread Andreas Kähäri
her a variable contains only an empty string, use "test -z variablename". Note that that does not test whether the variable is *set* though (unset variables expand to empty strings too, unless "set -u" is in effect, in which case it provokes an "unbound variable" diagnosti

Re: [PATCH 1/2] printf: fix heap buffer overflow in printf_builtin

2024-08-29 Thread Andreas Schwab
On Aug 29 2024, Andrey Kovalev wrote: > - for (fmt = format; *fmt; fmt++) > + for (fmt = format; fmt - format < strlen(format); fmt++) How is that different (apart from turing a linear runtime into quadratic runtime)? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fi

Re: procsub doesn't release the terminal without reading one byte

2024-10-13 Thread Andreas Schwab
On Okt 13 2024, Oğuz wrote: > Why though? Can't bash just close the procsub's stdin when `:' returns? bash has no handle on the command's stdin. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And

Re: Fwd: New feature

2024-10-12 Thread Andreas Schwab
On Okt 12 2024, Saint Michael wrote: > After using printf, right now I need to lunch a second command if I > need to expand the \n into real new lines. $ printf %b '\n' -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9

Re: Suggested BASH Improvement

2024-09-18 Thread Andreas Schwab
> Even the venerable BASH shell still has room for modernization > and improvement. Thank you for your interest and consideration. How is $((10#${data_line:12:2})) not modern? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA

Re: String substitution bug

2024-11-24 Thread Andreas Kähäri
On Sun, Nov 24, 2024 at 02:58:45PM -0500, Lawrence Velázquez wrote: > On Sun, Nov 24, 2024, at 10:08 AM, Andreas Kähäri wrote: > > On Sun, Nov 24, 2024 at 09:31:42AM -0500, Greg Wooledge wrote: > >> Similar cases exist elsewhere within the man page. For example, if you >

Re: [bug #66460] A documentation correction regarding an array nameref???

2024-11-18 Thread Andreas Kähäri
> > ___ > > Reply to this item at: > > <https://savannah.gnu.org/bugs/?66460> > > ___ > Message sent via Savannah > https://savannah.gnu.org/ -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: String substitution bug

2024-11-24 Thread Andreas Kähäri
s with > a bit of misunderstanding, leading to a few lost hours. > -- > Dormouse I think the manual is quite clear: Within [ and ], character classes can be specified using the syntax [:class:], where class is one of the following classes defined in the POSIX standard: alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit It says that the syntax "[:class:]" may be used within "[" and "]". To match a space-like character (including spaces, newlines and various types of tabs), you would therefore use "[[:space:]]". Would you want to match only a space, you would use a literal space. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: String substitution bug

2024-11-24 Thread Andreas Kähäri
it. > So, if someone scans down the page until they find the eye-catching > ${paramter:-word} definitions, and keeps reading from that point, > they will eventually find the paragraph about the colons, even before > the table. They don't have to read *backwards* to find it. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: Completion with -W fails if words contain ':'

2024-12-02 Thread Andreas Schwab
What is your value of COMP_WORDBREAKS? -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: String substitution bug

2024-11-24 Thread Andreas Kähäri
On Sun, Nov 24, 2024 at 10:51:43PM +1000, Martin D Kealey wrote: > On Sun, 24 Nov 2024 at 18:05, Andreas Kähäri wrote: > > > I think the manual is quite clear: > > > > Within [ and ], character classes can be specified > > using the syntax [:clas

Re: PIPESTATUS differs from $? for compound command

2024-12-09 Thread Andreas Schwab
pipeline are commands. > Both other examples, e.g. 'if false; then :; fi | true', > are, for PIPESTATUS purposes, equivalent to: 'true | true'. Why is `if false; then :; fi' not equivalent to `true' above? -- Andreas Schwab, sch...@linux-m68k.org GPG Key fi

Re: bind allows "impossible" key bindings without warning

2025-01-03 Thread Andreas Schwab
On Jan 03 2025, Dale R. Worley wrote: > It does seem like "bind" could be improved by providing an option that > shows all of the keysequences and what they are bound to. bind -p | sort -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 255

Re: "printf %d ''" should diagnose the empty string

2025-02-10 Thread Andreas Schwab
On Feb 10 2025, Greg Wooledge wrote: > No, I've shown that it *is* working in older versions of bash, and I'm > asking *why*. Does it? If it did, it should have printed -23, not -19. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE

Re: Documentation inconsistency (?)

2025-02-06 Thread Andreas Kähäri
meter:-word}`` > -- [cut] This was recently discussed: https://lists.gnu.org/archive/html/bug-bash/2025-01/msg00144.html -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: PIPESTATUS differs from $? for compound command

2024-12-11 Thread Andreas Schwab
On Dez 11 2024, Mike Jonkmans wrote: > Can a command - as part of a pipeline - not be a pipeline? ! true | { ! true; } -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: PIPESTATUS differs from $? for compound command

2024-12-09 Thread Andreas Schwab
commands as part of the pipeline (by your reasoning) are `false' and `true'. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: PIPESTATUS differs from $? for compound command

2024-12-10 Thread Andreas Schwab
On Dez 10 2024, Mike Jonkmans wrote: > With 'if false... fi | true' there are two pipelines: > 1) false > 2) (compound command) if | true There is only one pipeline, consisting of two commands. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1

Re: printf width format specifier doesn't work when assigned

2025-01-25 Thread Andreas Kähäri
$IFS (space, tab, and newline, by default), but also from using the split-up value as filename globbing patterns, which is what happens in your case. Just double quote the variable expansion: echo "$foo" -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: printf width format specifier doesn't work when assigned

2025-01-25 Thread Andreas Kähäri
e, tab, and newline, by default), but also from > using the split-up value as filename globbing patterns, which is what > happens in your case. > > Just double quote the variable expansion: > > echo "$foo" > > Sorry, I pressed send too quickly. I was going to suggest an alternative to using a command substitution and tr: printf -v foo '%*s' 80 ' ' echo "${foo// /*}" -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: SHELLOPTS environment variable causes shell options to cascade

2025-01-05 Thread Andreas Schwab
On Jan 05 2025, Tobi Laskowski wrote: > "Additionally, if it is in the environment at start up, the variable is > automatically exported That is a general property of every environment variable. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510

Re: Bash' code to store string of any characters containing pair of "" and '' at once

2024-12-22 Thread Andreas Schwab
On Dez 22 2024, Martin D Kealey wrote: > If you don't mind even more thinking then you can instead memorize the list > of characters that need \ and skip all the others; they are space, tab, > newline, and "#$'&<>*()?`\[]| Careful. \ has a different meaning.

Re: [Assignements to variables with integer attribute are expanded recursively]

2025-01-08 Thread Andreas Kähäri
ffectively allows for recursive arithmetic expansion of the right-hand side of an assignment to a variable with the integer attribute. Recursive, that is, until the right-hand side is no longer a variable's name, at which point the expansion stops and the value is assigned (or an error is generated if the value is not a valid integer). -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

5.3.0-beta: readline mishandles prompt with inivisible characters that wraps around

2025-01-02 Thread Andreas Schwab
$ PS1="\[$(tput bold)\]\w\\\$\[$(tput sgr0)\] " $ cd /tmp $ for i in 1 2 3 4 5 6 7 8; do mkdir 1234567890; cd 1234567890; done The second line of the prompt is not rendered in bold, and as the edited line gets longer the cursor jumps to the leftmost screen column. -- Andreas S

Re: Surprising behavior with inline environment variable expansion

2025-04-05 Thread Andreas Schwab
On Mär 31 2025, Chet Ramey wrote: > It's hard to see these as being useful if they're glibc-specific. They are coming from ISO TR 14652 and 30112. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for so

Re: Surprising behavior with inline environment variable expansion

2025-04-05 Thread Andreas Schwab
On Mär 26 2025, Andreas Kähäri wrote: > The argument to "bash -c" There is no "bash -c" in that command. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Surprising behavior with inline environment variable expansion

2025-03-26 Thread Andreas Schwab
cludes putting LC_NUMERIC=C in the temporary environment for the command). -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: Surprising behavior with inline environment variable expansion

2025-03-26 Thread Andreas Kähäri
On Wed, Mar 26, 2025 at 12:19:48PM +0100, Andreas Schwab wrote: > On Mär 26 2025, Léa Gris wrote: > > > Even though LC_NUMERIC=C is used to correctly parse 3.141592654, the > > expansion of $LC_NUMERIC still prints its original value (fr_FR.UTF-8). > > That is exp

Re: Surprising behavior with inline environment variable expansion

2025-03-26 Thread Andreas Kähäri
On Wed, Mar 26, 2025 at 01:35:12PM +0100, Andreas Schwab wrote: > On Mär 26 2025, Andreas Kähäri wrote: > > > The argument to "bash -c" > > There is no "bash -c" in that command. > > -- > Andreas Schwab, SUSE Labs, sch...@suse.de > GPG Key fing

Re: /dev/tcp feature request...

2025-04-08 Thread Andreas Schwab
On Apr 08 2025, MacBeth wrote: > while ((dur /dev/null; do You can use kill -0 $! to check if the process still exists. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: history writes to process substitution but errors reading it

2025-02-14 Thread Andreas Schwab
effect. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: [sr #111166] ngettext syntax

2025-02-22 Thread Andreas Schwab
On Feb 22 2025, Phi Debian wrote: > I forgot to mention your trick to nuke the fmt reuse still works > > $ printf '%s %s %s %999$s' A B C D E F G > A B C As long as NL_ARGMAX >= 999. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69

Re: bash --pretty-print and pattern

2025-02-20 Thread Andreas Kähäri
he command line before the single-character options to be recognized. -- Andreas (Kusalananda) Kähäri Uppsala, Sweden .

Re: Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread Andreas Schwab
On Mai 20 2025, FunnyMan Computer wrote: > In both cases, ${BASH_REMATCH[1]} should also have results stored. Why? There are no subexpression in your regexps. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And

Re: set -x path always returns 1 on fedora34 on arm64

2021-05-12 Thread Andreas Kusalananda Kähäri
rgument, and you are giving it "file]". Insert a space before that last "]". If that is not the code you are using, then consider posting the code you are using. If you don't, we can only really say "it works for me". > > On Wed, May 12, 2021,

Re: NL character removed after \\ in command substitution

2021-08-16 Thread Andreas Kusalananda Kähäri
$'hello \\world\n' (missing the \n after \\): > echo "$( > cat < hello \\ > world > EOF > )" Consider quoting the here-document: cat <<'EOF' hello \\ world EOF )" -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: NL character removed after \\ in command substitution

2021-08-16 Thread Andreas Kusalananda Kähäri
x27; (missing the \n after \\): > > echo "$( > > cat < > hello \\ > > world > > EOF > > )" > > > Consider quoting the here-document: > > cat <<'EOF' > hello \\ > world > EOF > )" > The initial line saying echo "$( was obviously missing there (copy+paste error), sorry. -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: Why tail coreutil cannot work as its input is from tee

2021-09-06 Thread Andreas Kusalananda Kähäri
n3\n1' |tee >(head -1) | tail -1 9 This is on an OpenBSD system. This depends on whether tee has a chance of outputting the complete data from echo to its standard output first, before the head outputs its data. With GNU tools, I can't get the pipeline to output 1, but I know

Re: Request change to output of declare -f funcname

2021-10-02 Thread Andreas Kusalananda Kähäri
r invalid as such, but that their usage of the resulting text involves replacing newlines with spaces, which turns it into invalid shell code. -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: some unknown bug, says : command not found

2021-11-01 Thread Andreas Kusalananda Kähäri
istyping in its name?) $ "$my_thnig" <( [[ -s "$pathname" ]] && cat -- "$pathname" ) bash: : command not found -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: can't unset hash item with specific key

2021-12-12 Thread Andreas Kusalananda Kähäri
# try to remove item > show "wrong" # can still output item, item still > counts > > unset "a['['foo]]"# try to remove item > show "wrong" # can still output item, item still > counts > > a["[foo]"]="" # Best I can currently do > show "set empty, item still counted" # item still there though contents are > empty string. Just to say this unsets the element correctly: k='[foo]' unset -v 'a["$k"]' -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: A bug when using bash shell variable

2022-01-13 Thread Andreas Kusalananda Kähäri
yS0" -drive file=root.ext4,format=raw,id=hd0 > -device virtio-blk-device,drive=hd0 > > junan@u0:~/Documents/coding/run-riscv-qemu-linux$ strace $QEMU $QOPTIONS > execve("/usr/bin/qemu-system-riscv64", ["qemu-system-riscv64", "-nographic", > "-ma

Re: A bug when using bash shell variable

2022-01-13 Thread Andreas Kusalananda Kähäri
gt; > https://unix.stackexchange.com/questions/68694/when-is-double-quoting-necessary > https://unix.stackexchange.com/questions/444946/how-can-we-run-a-command-stored-in-a-variable > > (and others) > > > On Thu, Jan 13, 2022 at 10:13:05AM +, ju nan wrote: [cut] -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Andreas Kusalananda Kähäri
s potential to be a security issue. > > Highly unlikely. It would require an implausible scenario. Mind if I use that quote? :-) Example of interesting values to test in PS1, with discussions: https://security.stackexchange.com/q/56307 -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: Bash not escaping escape sequences in directory names

2022-01-22 Thread Andreas Kusalananda Kähäri
On Sat, Jan 22, 2022 at 01:28:50PM -0500, Chet Ramey wrote: > On 1/22/22 5:52 AM, Andreas Kusalananda Kähäri wrote: > > On Fri, Jan 21, 2022 at 06:33:02PM -0500, Chet Ramey wrote: > > > On 1/21/22 6:13 PM, Mike Jonkmans wrote: > > > > On Fri, Jan 21, 2022 at 03:2

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Andreas Kusalananda Kähäri
On Mon, Jan 24, 2022 at 10:41:32AM -0500, Chet Ramey wrote: > On 1/22/22 3:48 PM, Andreas Kusalananda Kähäri wrote: > > On Sat, Jan 22, 2022 at 01:28:50PM -0500, Chet Ramey wrote: > > > On 1/22/22 5:52 AM, Andreas Kusalananda Kähäri wrote: > > > > On Fri, Jan 21,

Re: Bash not escaping escape sequences in directory names

2022-01-24 Thread Andreas Kusalananda Kähäri
On Tue, Jan 25, 2022 at 02:24:26AM +0700, Robert Elz wrote: > Date:Mon, 24 Jan 2022 19:53:03 +0100 > From: Andreas Kusalananda =?utf-8?B?S8OkaMOkcmk=?= > > Message-ID: > > | Why would people want it to do that (i.e. export PS1)? > > It is

Re: Bash not escaping escape sequences in directory names

2022-01-26 Thread Andreas Kusalananda Kähäri
On Wed, Jan 26, 2022 at 12:26:05AM -0800, L A Walsh wrote: > On 2022/01/22 12:48, Andreas Kusalananda Kähäri wrote: > > The shell even keeps the PS1 variable's value from its inherited > > environment > > without sanitizing it. > > > > This is a requir

Re: command line not saved after "event not found" error

2022-02-20 Thread Andreas Kusalananda Kähäri
's the fact that it is a history expansion (albeit a failed one). History expansions are not saved in the history. If history expansions, like !! to execute the most recent command in history, was saved to the shell's command history, then what would the shell execute if you entered !! for the secand time in a row? -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

"~~" and "~" case-toggling modification undocumented

2022-04-05 Thread Andreas Kusalananda Kähäri
uot;) or the all characters that match the pattern ("~~") in a similar manner as up-casing and down-casing is done with "^" and ",". However, as far as I can see, the case-toggling operators remain undocumented. I wonder if this is on purpose due to some instability

Re: "~~" and "~" case-toggling modification undocumented

2022-04-05 Thread Andreas Kusalananda Kähäri
On Tue, Apr 05, 2022 at 10:58:33AM -0400, Chet Ramey wrote: > On 4/5/22 10:49 AM, Andreas Kusalananda Kähäri wrote: > > When the ",", ",,", "^", and "^^" case-modifying operators were > > introduced with Bash 4.0 some 13 years ago, the operato

Re: "trap" output from "if" statement redirected wrongly

2022-04-14 Thread Andreas Kusalananda Kähäri
standard streams is part of what is included in "the environment". The environment in which the shell executes a trap on EXIT shall be identical to the environment immediately after the last command executed before the trap on EXIT was taken. (from ht

Re: IFS field splitting doesn't conform with POSIX

2023-03-30 Thread Andreas Kusalananda Kähäri
though it does not have > an an explicit terminator. But that's not specified anywhere in POSIX. > > POSIX doesn't say what should be done with the text after the last > terminator. You could throw it away and still be conforming to POSIX. > > -- > Felipe Contreras -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: bug attached

2023-08-30 Thread Andreas Kusalananda Kähäri
t; will remain unchanged (until you increment it from "3" to "4"). On an unrelated note, you sohuld be printing the value using a static formatting string, like so: printf '%s\n' "$aa" This avoids interpreting the value of the variable as a printf formatting string. -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .

Re: bug attached

2023-08-31 Thread Andreas Kusalananda Kähäri
ble scope is restricted to that function and its children (including the functions it calls). > > > On Wed, Aug 30, 2023 at 5:59 PM Andreas Kusalananda Kähäri < > andreas.kah...@abc.se> wrote: > > > On Wed, Aug 30, 2023 at 03:40:21PM +0300, queency3 jones w

riscv32, qemu-user: semi-functional, what goes wrong?

2023-08-31 Thread Andreas K. Huettel
told bash works fine in a riscv32 system emulation. Below is the output of the bash testsuite. Any advice on where to start looking for problems would be appreciated. Best, Andreas >>> Test phase: app-shells/bash-5.2_p15-r6 make -j1 check make[1]: Entering directory '/var/tmp

Re: riscv32, qemu-user: semi-functional, what goes wrong?

2023-09-12 Thread Andreas K. Huettel
Am Dienstag, 12. September 2023, 21:55:13 CEST schrieb Chet Ramey: > On 8/31/23 7:02 PM, Andreas K. Huettel wrote: > > Dear all, > > > > I'm trying to get qemu usermode emulation of riscv32 working. > > I managed to cross-build a linux system, and have it mostly r

Re: riscv32, qemu-user: semi-functional, what goes wrong?

2023-09-12 Thread Andreas K. Huettel
ad' builtin > is called. The /dev/tty tests can be fooled by typeahead while the tests > are running, but that doesn't usually happen. Could a timeout also mean that part of the data "got lost" and it's trying to read more than is available? -- Andreas K. Hüttel dilfri...@gentoo.org Gentoo Linux developer (council, toolchain, base-system, perl, libreoffice) signature.asc Description: This is a digitally signed message part.

Re: riscv32, qemu-user: semi-functional, what goes wrong?

2023-09-16 Thread Andreas K. Huettel
,2], where apparently wait() returns an undocumented exit code. Since wait seems to also be involved above, I tend to blame this in qemu now... [1] https://savannah.gnu.org/bugs/?64664 [2] https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg03207.html -- Andreas K. Hüttel dilfri...@gentoo.org Gentoo Linux developer (council, toolchain, base-system, perl, libreoffice) signature.asc Description: This is a digitally signed message part.

feature request: file_not_found_handle()

2013-08-14 Thread Andreas Gregor Frank
-command-includes-a-slash-tp7118.html Why are the patches not part of the bash? Use case: -see: command_not_found_handle() Cheers, Andreas

Re: feature request: file_not_found_handle()

2013-08-17 Thread Andreas Gregor Frank
ircles...: http://gnu-bash.2382.n7.nabble.com/command-not-found-handle-not-called-if-command-includes-a-slash-tp7118.html @all: If there is a reason for not fixing this 'bug', i would like to hear. bye Andreas

Re: feature request: file_not_found_handle()

2013-08-19 Thread Andreas Gregor Frank
vent" (independent of the command_not_found_handle history). You say you can easily test whether or not if the file in the pathname exists. And Ken's recommendation to trigger a no_such_file_or_directory_handle() is minimally invasive. So why not ? Andreas * * * * ** 2013/8/18 Chet Ra

Re: feature request: file_not_found_handle()

2013-08-19 Thread Andreas Gregor Frank
ethod... So at the moment slashes are forbidden in object names in my fun project. Now you know why your bash example for ckexec() isn't a solution for me. bye Andreas 2013/8/19 Chet Ramey > On 8/19/13 6:57 AM, Andreas Gregor Frank wrote: > > Hi Chet, > > > > I have no

Re: feature request: file_not_found_handle()

2013-08-21 Thread Andreas Gregor Frank
. How someone uses a bash feature in his scripts is not the problem of this mailing list i hope. Andreas . 2013/8/21 Greg Wooledge > On Wed, Aug 21, 2013 at 02:22:24AM -0800, Ken Irving wrote: > > $ cat $(ambler.method dispatch) > > #!/bin/bash > > method=$1 &&a

Re: feature request: file_not_found_handle()

2013-08-21 Thread Andreas Gregor Frank
Hi Eduardo, thank you very much for this constructive and honest answer. Not what i hoped to see, but this is only a request. For me only a nice to have...so fine bye Andreas 2013/8/21 Eduardo A. Bustamante López > On Wed, Aug 21, 2013 at 08:39:53PM +0200, Andreas Gregor Frank wr

Re: [doc] missing doc about :+ vs + expansion

2019-03-25 Thread Andreas Kusalananda Kähäri
hristophe It is not omitted. The paragraph before the list of parameters expansions in the manual reads When not performing substring expansion, using the forms documented below (e.g., :-), bash tests for a parameter that is unset or null. Omitting the colon results in a test

Re: "here strings" and tmpfiles

2019-04-11 Thread Andreas Kusalananda Kähäri
On Thu, Apr 11, 2019 at 09:01:50PM +0800, konsolebox wrote: > On Thu, Apr 11, 2019, 4:04 PM Andreas Schwab wrote: > > > On Apr 10 2019, Daniel Kahn Gillmor wrote: > > > > > data written to the local filesystem can be discovered by someone > > > analyzing

<    3   4   5   6   7   8   9   >