help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: i cant see whats the issue, .. ps1 + propt command + date


From: Alex fxmbsw7 Ratchev
Subject: Re: i cant see whats the issue, .. ps1 + propt command + date
Date: Sat, 25 Sep 2021 21:38:22 +0200

thats all around correct, tho its not 'when command inside alias the
chain is broken'
its begin / end it right

alias a=b=c\  d=$'\nprintf %s "$b"\n ' e=$'\nyes | head -1\n '

a d e


c
y

no idea why that ( and sometimes else ) displays this, may be windows
terminal related

thanks anyway anyhow again ! good mate , keep up the good help and
dont fail in ignoring enemies ehe :))

On Sat, Sep 25, 2021 at 9:20 PM Greg Wooledge <greg@wooledge.org> wrote:
>
> On Sat, Sep 25, 2021 at 09:09:56PM +0200, Alex fxmbsw7 Ratchev wrote:
> > alias s='_s=$( declare -p 2>&- IFS ) ' r='eval "${_s:-unset -v IFS}" '
> > now=$EPOCHREALTIME s IFS=. now2=( $now ) r ; declare -p now2
> > bash: declare: now2: not found
>
> Well, this is as expected.  You're doing this:
>
> unicorn:~$ bash --norc
> bash-5.1$ array=(1 2) eval true
> bash-5.1$ declare -p array
> bash: declare: array: not found
>
> In other words, your assignments are only temporary variables for the
> duration of the eval command.
>
> Your magic "alias expansion to an assignment in the middle of a stream
> of assignments" no longer works when one of the aliases expands to
> be an actual command (eval), instead of an assignment.
>
> Of note, when bash runs in POSIX mode, temporary assignemnts for the
> duration of *certain* special builtin commands become no longer
> temporary:
>
> unicorn:~$ bash --norc --posix
> bash-5.1$ array=(1 2) eval true
> bash-5.1$ declare -p array
> declare -x array="(1 2)"
>
> I don't know whether this helps you, but it seems related, and you
> might want to have this new toy that can help you break more things.
> You can blame POSIX for this particular piece of nonsense.  Bash doesn't
> do it by default.
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]