Hi Eli
How about using the shell itself to parse the output of "typeset" (an alias
for "declare"), but redefining "declare" to do something different. This is
a bit verbose but it works cleanly:
```
(
function declare {
while [[ $1 = -* ]] ; do shift ; done
printf %s\\n "${@%%=*}"
}
On Mon, 26 Jun 2023 17:09:47 +1000
Martin D Kealey wrote:
> Hi Eli
>
> How about using the shell itself to parse the output of "typeset" (an alias
> for "declare"), but redefining "declare" to do something different. This is
> a bit verbose but it works cleanly:
>
> ```
> (
> function declare
On Mon, Jun 26, 2023, 00:25 Eli Schwartz wrote:
> compgen is a useful builtin for inspecting information about the shell
> context e.g. in scripts -- a good example of this is compgen -A function
> or compgen -A variable.
>
> But it's not always available depending on how bash is built, which
> r
On Mon, Jun 26, 2023, 11:33 Kerin Millar wrote:
> On Mon, 26 Jun 2023 17:09:47 +1000
> Martin D Kealey wrote:
>
> > Hi Eli
> >
> > How about using the shell itself to parse the output of "typeset" (an
> alias
> > for "declare"), but redefining "declare" to do something different. This
> is
> > a
On Mon, Jun 26, 2023, 11:51 alex xmb ratchev wrote:
>
>
> On Mon, Jun 26, 2023, 11:33 Kerin Millar wrote:
>
>> On Mon, 26 Jun 2023 17:09:47 +1000
>> Martin D Kealey wrote:
>>
>> > Hi Eli
>> >
>> > How about using the shell itself to parse the output of "typeset" (an
>> alias
>> > for "declare")
On Mon, Jun 26, 2023, 11:55 alex xmb ratchev wrote:
>
>
> On Mon, Jun 26, 2023, 11:51 alex xmb ratchev wrote:
>
>>
>>
>> On Mon, Jun 26, 2023, 11:33 Kerin Millar wrote:
>>
>>> On Mon, 26 Jun 2023 17:09:47 +1000
>>> Martin D Kealey wrote:
>>>
>>> > Hi Eli
>>> >
>>> > How about using the shell i
On Mon, 26 Jun 2023 11:47:21 +0200
alex xmb ratchev wrote:
> On Mon, Jun 26, 2023, 00:25 Eli Schwartz wrote:
>
> > compgen is a useful builtin for inspecting information about the shell
> > context e.g. in scripts -- a good example of this is compgen -A function
> > or compgen -A variable.
> >
On Mon, 26 Jun 2023 11:51:58 +0200
alex xmb ratchev wrote:
> On Mon, Jun 26, 2023, 11:33 Kerin Millar wrote:
>
> > On Mon, 26 Jun 2023 17:09:47 +1000
> > Martin D Kealey wrote:
> >
> > > Hi Eli
> > >
> > > How about using the shell itself to parse the output of "typeset" (an
> > alias
> > > fo
On Mon, Jun 26, 2023, 11:58 Kerin Millar wrote:
> On Mon, 26 Jun 2023 11:47:21 +0200
> alex xmb ratchev wrote:
>
> > On Mon, Jun 26, 2023, 00:25 Eli Schwartz wrote:
> >
> > > compgen is a useful builtin for inspecting information about the shell
> > > context e.g. in scripts -- a good example o
alex xmb ratchev writes:
> On Mon, Jun 26, 2023, 11:55 alex xmb ratchev wrote:
>
>>[snip]
> u also really dont need eval at all
>
> by the way , what does this nonsense code supposed to do
>> separate between vars for future list / deletement ?
If you read the linked bug, you'd find out.
On Mon, 26 Jun 2023 11:55:03 +0200
alex xmb ratchev wrote:
> by the way , what does this nonsense code supposed to do
> separate between vars for future list / deletement ?
Print all declared variable names reliably (which it doesn't). It's not as easy
as you might think, by the way.
--
Kerin
On Mon, Jun 26, 2023, 12:01 Kerin Millar wrote:
> On Mon, 26 Jun 2023 11:51:58 +0200
> alex xmb ratchev wrote:
>
> > On Mon, Jun 26, 2023, 11:33 Kerin Millar wrote:
> >
> > > On Mon, 26 Jun 2023 17:09:47 +1000
> > > Martin D Kealey wrote:
> > >
> > > > Hi Eli
> > > >
> > > > How about using th
On Mon, Jun 26, 2023, 12:03 Kerin Millar wrote:
> On Mon, 26 Jun 2023 11:55:03 +0200
> alex xmb ratchev wrote:
>
> > by the way , what does this nonsense code supposed to do
> > separate between vars for future list / deletement ?
>
> Print all declared variable names reliably (which it doesn't)
On Mon, 26 Jun 2023 12:03:47 +0200
alex xmb ratchev wrote:
> On Mon, Jun 26, 2023, 12:01 Kerin Millar wrote:
>
> > On Mon, 26 Jun 2023 11:51:58 +0200
> > alex xmb ratchev wrote:
> >
> > > On Mon, Jun 26, 2023, 11:33 Kerin Millar wrote:
> > >
> > > > On Mon, 26 Jun 2023 17:09:47 +1000
> > > >
On Mon, Jun 26, 2023, 12:10 Kerin Millar wrote:
> On Mon, 26 Jun 2023 12:03:47 +0200
> alex xmb ratchev wrote:
>
> > On Mon, Jun 26, 2023, 12:01 Kerin Millar wrote:
> >
> > > On Mon, 26 Jun 2023 11:51:58 +0200
> > > alex xmb ratchev wrote:
> > >
> > > > On Mon, Jun 26, 2023, 11:33 Kerin Millar
hmm, declare -p used to print an array like
ˋˋˋ
declare -a array='([0]="value" [1]="value")'
ˋˋˋ
At some stage declare -p stopped printing the extra outer quotes, so that
my approach also stops working.
On Mon, 26 Jun 2023, 19:32 Kerin Millar, wrote:
> On Mon, 26 Jun 2023 17:09:47 +1000
> Martin
On Mon, Jun 26, 2023, 14:08 Martin D Kealey wrote:
> hmm, declare -p used to print an array like
> ˋˋˋ
> declare -a array='([0]="value" [1]="value")'
> ˋˋˋ
> At some stage declare -p stopped printing the extra outer quotes, so that
> my approach also stops working.
>
quotes matter to input
diffe
On 6/26/23 5:32 AM, Kerin Millar wrote:
> While it is understandable that an attempt to assign to certain shell
> variables would be treated as an error, the combination of not
> printing a diganostic message and inducing a non-interactive shell to
> exit is rather confusing. Further, declare is gr
Good day.
Something strange is happening to me with this script that I have designed
moments ago.
I am a Computer Science professor, and among the subjects I teach, there is
one that has to do with BASH programming.
I make my own material, therefore, I have been working since last year with
this c
On Mon, Jun 26, 2023, 11:07 AM Hugo Napoli wrote:
> Good day.
>
> Something strange is happening to me with this script that I have designed
> moments ago.
> I am a Computer Science professor, and among the subjects I teach, there is
> one that has to do with BASH programming.
> I make my own mat
On 6/23/23 7:11 PM, Grisha Levit wrote:
I think we can have bash honor ignoreeof and not exit after delimiting the
token or command while not acting quite as bizarrely as ksh88.
I think the new behavior is quite reasonable. Though it does need
something to allow the exit builtin to work even
On 6/17/23 4:28 AM, Grisha Levit wrote:
When readline's display of completion matches is interrupted, the match
list is only freed for the '?' completion type but not for '!' and '@'
types. I couldn't find a specific reason for that to be the case so
hope this patch is an OK fix.
Thanks, this
dead.bashbug
Description: Binary data
On Mon, Jun 26, 2023 at 03:36:58PM -0300, Hugo Napoli wrote:
> #!/bin/bash
>
> clear
>
> echo ""
> read -p "Ingrese un número entero de hasta 2 cifras
> : " min
> read -p "Ingrese otro número entero de hasta 2 cifras, mayor que el
> anterior : " max
>
> if [[ ${#min} -gt 2 ]] || [[ ${#max}
if u modify PS1 , u must enclose escape / color codes in literarly \[ and \]
eg
PS1=$'\[\e[0;1m\]bold\[\e[0m\] '
and the err u say , looks like u didnt make that proper bind cmd
On Mon, Jun 26, 2023, 19:15 Kaif Khan wrote:
>
>
Date:Mon, 26 Jun 2023 10:32:19 +0100
From:Kerin Millar
Message-ID: <20230626103219.0f74c089c616248cee6ab...@plushkava.net>
| Further, declare is granted special treatment, even after having been
| defined as a function (which might be a bug).
That will be becaus
On Mon, Jun 26, 2023, 2:47 PM Hugo Napoli wrote:
> Dear Dennis and Martin, thank you very much for the quick response.
>
> From now on, I'll use *exec bash "$0" *instead of *bash "$0"*.
> What I'm wondering is (now that I understand why this happened) if there
> is some special situation where it
On 6/24/23 9:40 PM, Grisha Levit wrote:
When printing the command for xtrace, if a word or assignment rhs contains
a shell meta character, ansi quoting is not applied even if it otherwise
should be.
Thanks for the report. It seems reasonable to prioritize ansic-quoting over
shell-metacharacter
I will, and the suggestions and examples that you both told me, were
excellent, and a display of remarkable generosity and value.
As an educator, I have now learned more solid criteria for teaching some
BASH techniques to my students.
Starting tomorrow, we will be discussing and observing all of th
diff --git a/subst.c b/subst.c
index 215e3469..63ca3370 100644
--- a/subst.c
+++ b/subst.c
@@ -1042,7 +1042,7 @@ skip_double_quoted (const char *string, size_t
slen, int sind, int flags)
if (string[i + 1] == LPAREN)
ret = extract_command_subst (string, &si,
SX_NOALLOC|(flags&S
On Tue, 27 Jun 2023 02:23:23 +0700
Robert Elz wrote:
> Date:Mon, 26 Jun 2023 10:32:19 +0100
> From:Kerin Millar
> Message-ID: <20230626103219.0f74c089c616248cee6ab...@plushkava.net>
>
>
> | Further, declare is granted special treatment, even after having been
>
On Tue, Jun 27, 2023, 07:23 alex xmb ratchev wrote:
>
>
> On Tue, Jun 27, 2023, 04:55 Kaif Khan wrote:
>
>> Thank you for your response, but my bug is rather very simple and not
>> complicated. I am attaching a video to explain the bug.
>>
>
whats the output of
declare -p PS0 PS1 PROMPT_COMMAND
Is this correct?
declare -A l1
l1=([a]=b [c]=d)
echo ${!l1[@]}
l1=($(echo [a]=b [c]=d))
echo ${!l1[@]}
$ bash t4
c a
[a]=b [c]=d
If so, why? And how can I assign a list of members to an associative array?
33 matches
Mail list logo