Re: use-cases promote thinking of limited application

2021-08-22 Thread Koichi Murase
2021年8月23日(月) 13:40 L A Walsh : > > On 2021/08/22 19:14, Koichi Murase wrote: > > I'd guess Ilkka has asked the use case for this particular output > > format, i.e., the quoted fields inside a single word. If the purpose > > is organizing the data, I would naturally expect the result in the > > fo

Re: use-cases promote thinking of limited application

2021-08-22 Thread L A Walsh
On 2021/08/22 19:14, Koichi Murase wrote: I'd guess Ilkka has asked the use case for this particular output format, i.e., the quoted fields inside a single word. If the purpose is organizing the data, I would naturally expect the result in the following more useful format in separate words wi

bug-bash@gnu.org

2021-08-22 Thread Greg Wooledge
On Sun, Aug 22, 2021 at 10:33:13PM -0400, Lawrence Velázquez wrote: > An example in the original post asserted that tmp_var "will not > exist when PS1 is expanded", so it must be inserted when PS1 is > defined. This requirement seems pretty contrived to me (why can't > tmp_var be kept around, exac

bug-bash@gnu.org

2021-08-22 Thread Lawrence Velázquez
> On Aug 22, 2021, at 10:22 PM, Koichi Murase wrote: > > 2021年8月23日(月) 6:13 Emanuele Torre : >> It would be nice to have a parameter transformation (e.g. "${par@p}") >> that expands $par to a string that will not be expanded by PS1, PS2, &c. > > It seems to me that you can just put '$par' (not "

bug-bash@gnu.org

2021-08-22 Thread Koichi Murase
2021年8月23日(月) 6:13 Emanuele Torre : > It would be nice to have a parameter transformation (e.g. "${par@p}") > that expands $par to a string that will not be expanded by PS1, PS2, &c. It seems to me that you can just put '$par' (not "$par") in PS1. Then, the suggested "${par@p}" can be simply '$par

Re: use-cases promote thinking of limited application

2021-08-22 Thread Koichi Murase
2021年8月23日(月) 10:54 L A Walsh : > On 2021/08/19 02:15, Ilkka Virta wrote: > > $ declare -A A=([foo bar]="123 456" [adsf]="456 789") > > $ printf "<%s>\n" "${A[@]@K}" > > > > > > Interesting. I wonder, what's the intended use-case for this? > > > --- > Does it matter?: Organizing data. I'd guess I

use-cases promote thinking of limited application

2021-08-22 Thread L A Walsh
On 2021/08/19 02:15, Ilkka Virta wrote: $ declare -A A=([foo bar]="123 456" [adsf]="456 789") $ printf "<%s>\n" "${A[@]@K}" Interesting. I wonder, what's the intended use-case for this? --- Does it matter?: Organizing data. In this case, the data may be organized by pairs. If you have a l

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Chet Ramey
On 8/22/21 7:52 PM, Kerin Millar wrote: On Sun, 22 Aug 2021 16:13:28 -0400 Chet Ramey wrote: On 8/21/21 1:28 AM, Emanuele Torre wrote: Bash Version: 5.1 Patch Level: 8 Release Status: release get_epochrealtime() casts tv.tv_sec (a time_t a.k.a. int) to unsigned int causing EPOCHREALTIME

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Kerin Millar
On Sun, 22 Aug 2021 16:13:28 -0400 Chet Ramey wrote: > On 8/21/21 1:28 AM, Emanuele Torre wrote: > > > Bash Version: 5.1 > > Patch Level: 8 > > Release Status: release > > > > > get_epochrealtime() casts tv.tv_sec (a time_t a.k.a. int) to unsigned > > int causing EPOCHREALTIME to not behave co

bug-bash@gnu.org

2021-08-22 Thread Alex fxmbsw7 Ratchev
a bit better ~ $ a=( \' \\ \$var $'\e[1m' ) ps='$ ' ; printf -v q %q\ "${a[@]}" ; ps+=$q ; printf %s\\n "$ps" $ \' \\ \$var $'\E[1m' On Mon, Aug 23, 2021, 00:50 Alex fxmbsw7 Ratchev wrote: > oh indeed it doesnt do what you want > maybe printf %q does > sorry > > On Mon, Aug 23, 2021, 00:45 Ale

bug-bash@gnu.org

2021-08-22 Thread Alex fxmbsw7 Ratchev
oh indeed it doesnt do what you want maybe printf %q does sorry On Mon, Aug 23, 2021, 00:45 Alex fxmbsw7 Ratchev wrote: > i meant this with removing quotes > > ~ $ shopt -s extglob ; a=( . a \' \$var $'\e[1m' ) ps='$ ' a=( "${a[@]@Q}" > ) ; for i in ${!a[@]} ; do a[i]=${a[i]#?(\$)\'} a[i]=${a[i]

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Alex fxmbsw7 Ratchev
lol undefined behavior, tho its important to test such important functionality, as setting time back bad book by the live of 'use your computer only so' im just saying nowadays as earlier software is more ugly bugs than useful On Sun, Aug 22, 2021, 23:28 Greg Wooledge wrote: > On Sun, Aug 22,

bug-bash@gnu.org

2021-08-22 Thread Alex fxmbsw7 Ratchev
i meant this with removing quotes ~ $ shopt -s extglob ; a=( . a \' \$var $'\e[1m' ) ps='$ ' a=( "${a[@]@Q}" ) ; for i in ${!a[@]} ; do a[i]=${a[i]#?(\$)\'} a[i]=${a[i]%\'} ; done ; ps+=${a[*]} ; printf %s\\n "$ps" $ . a \ $var \E[1m ~ $ On Mon, Aug 23, 2021, 00:02 Emanuele Torre wrote: > Emanu

bug-bash@gnu.org

2021-08-22 Thread Emanuele Torre
Emanuele Torre wrote: > ~ --${@Q}-> '~' --${#\'}-> ~' --${%\'}-> ~ Sorry, that was a bad example. Still, it does not accomplish anything: \w --${@Q}-> '\w' --${#\'}-> \w' --${%\'}-> \w On Sun, 22 Aug 2021 at 23:56, Emanuele Torre wrote: > > Alex fxmbsw7 Ratchev wrote: > > and renoving the

bug-bash@gnu.org

2021-08-22 Thread Emanuele Torre
Alex fxmbsw7 Ratchev wrote: > and renoving the beginning and ending ' s even if you remove the first and last ': 1) that is 3 PEs as the solution i described (${a//\\/} ${a//\`/\\\`} ${a//$/\\$} vs ${a@Q} ${a#\'} ${a%\'} ) 2) it doesn't actually accomplish anything: ~ --${@Q}-> '~' --${#\'

bug-bash@gnu.org

2021-08-22 Thread Emanuele Torre
That is not at all the same thing. $ t='~' q='?' s='*' n=$'\n' bn='\n' $ a="hello ${t@Q} ${q@Q} ${s@Q} ${n@Q} ${bn@Q} hi" $ printf '%s\n' "${a@P}" hello '~' '?' '*' $' ' ' ' hi With the parameter transformation I requested, this is what should be printed: $ t='~' q='?' s='*' n=$'\n

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Greg Wooledge
On Sun, Aug 22, 2021 at 10:30:26PM +0200, Alex fxmbsw7 Ratchev wrote: > why disregard or invalid, mark 0 is that date, less is minus, .. all working It's not that simple. Calendars get really *interesting* if you go farther back in history. The switch from the Julian to the Gregorian calendar di

bug-bash@gnu.org

2021-08-22 Thread Alex fxmbsw7 Ratchev
what about @Q and renoving the beginning and ending ' s On Sun, Aug 22, 2021, 23:13 Emanuele Torre wrote: > It would be nice to have a parameter transformation (e.g. "${par@p}") > that expands $par to a string that will not be expanded by PS1, PS2, &c. > > example: > > tmp_var=$(blabla) # thi

bug-bash@gnu.org

2021-08-22 Thread Emanuele Torre
It would be nice to have a parameter transformation (e.g. "${par@p}") that expands $par to a string that will not be expanded by PS1, PS2, &c. example: tmp_var=$(blabla) # this variable will not exist when PS1 is expanded PS1="blabla ${tmp_var@p} blabla" I think a valid way to achieve the sa

Re: Issue declaring an array via a variable name

2021-08-22 Thread Alex fxmbsw7 Ratchev
yea i dunno to say, i dont care, peace.. On Sun, Aug 22, 2021, 22:48 Lawrence Velázquez wrote: > On Sun, Aug 22, 2021, at 4:38 PM, Alex fxmbsw7 Ratchev wrote: > > last time again > > You promise? > > > one pair quotes, not more > > Except you're wrong. > > $ val=foo > $ declare "$val"='x' > $ de

Re: Issue declaring an array via a variable name

2021-08-22 Thread Lawrence Velázquez
On Sun, Aug 22, 2021, at 4:38 PM, Alex fxmbsw7 Ratchev wrote: > last time again You promise? > one pair quotes, not more Except you're wrong. $ val=foo $ declare "$val"='x' $ declare -p "$val" declare -- foo="x" $ val=bar $ declare -a "$val"='(baz quux)' $ declare -p "$val" declare -a bar=([0]

Re: Issue declaring an array via a variable name

2021-08-22 Thread Alex fxmbsw7 Ratchev
as i said how to make it work, last time again, one pair quotes, not more On Sun, Aug 22, 2021, 22:37 Chet Ramey wrote: > On 8/21/21 6:02 PM, Hunter Wittenborn wrote: > >> As an end user I would expect the unquoted `(' > > > >> operator to cause a syntax error, just as it does in `echo ('. > > >

Re: Issue declaring an array via a variable name

2021-08-22 Thread Chet Ramey
On 8/21/21 6:02 PM, Hunter Wittenborn wrote: As an end user I would expect the unquoted `(' operator to cause a syntax error, just as it does in `echo ('. Well I'm expecting '(' to be part of the shell's syntax (when unquoted; so likewise not cause a syntax error), but when looking at thi

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Alex fxmbsw7 Ratchev
why disregard or invalid, mark 0 is that date, less is minus, .. all working On Sun, Aug 22, 2021, 22:13 Chet Ramey wrote: > On 8/21/21 1:28 AM, Emanuele Torre wrote: > > > Bash Version: 5.1 > > Patch Level: 8 > > Release Status: release > > > > > get_epochrealtime() casts tv.tv_sec (a time_t a.

Re: EPOCHREALTIME does not behave correctly before 1970

2021-08-22 Thread Chet Ramey
On 8/21/21 1:28 AM, Emanuele Torre wrote: Bash Version: 5.1 Patch Level: 8 Release Status: release get_epochrealtime() casts tv.tv_sec (a time_t a.k.a. int) to unsigned int causing EPOCHREALTIME to not behave correctly before the Unix Epoch. The definition is seconds since the Unix epoch.

Re: Issue declaring an array via a variable name

2021-08-22 Thread Oğuz
22 Ağustos 2021 Pazar tarihinde Hunter Wittenborn < hun...@hunterwittenborn.com> yazdı: > > Well I'm expecting '(' to be part of the shell's syntax (when unquoted; so > likewise not cause a syntax error), but when looking at things like the > left side of a variable assignment, I'm sure you'll agre