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:11:45 +0200

btw also your two examples were invalid cause it does var=$var, not declare -p
cause in the case the var is unset it will be set, with yours
i dont mind, you tried, not so hard, i saw,
but again.. thanks !

On Sat, Sep 25, 2021 at 9:09 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>
> so thank you big time for writing me back
>
> i havent tried ( exactly ) the your two examples but i did with mine,
> just on the term with --norc
> it bugs..
>
> 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
>
> the regarding spaces and newlines i havent experienced any non working
> aliases for me are 1:1 text replacements, ..
> it just weird in this case another bug ( this here, not additionally more )
>
> i have to rely on bash being stable
> a new2 not appearing / disappearing is a reason to make bash bugfixed
> stable instead of work around ( .. such major bugs )
>
> On Sat, Sep 25, 2021 at 8:58 PM Greg Wooledge <greg@wooledge.org> wrote:
> >
> > On Sat, Sep 25, 2021 at 08:25:59PM +0200, Alex fxmbsw7 Ratchev wrote:
> > > ++ prptnow=1632594230.535965
> > > +++ declare -p IFS
> > > ++ __savedIFS='declare -- IFS=$'\'' \t\n'\'''
> > > ++ IFS=.
> > > ++ prptnow2='(1632594230.535965)'
> >
> > I don't know why you're making your life so incredibly difficult.  You
> > could use the ${now#*.} and ${now%.*} expansions as I showed before, and
> > this would all be a thing of the past.
> >
> > If you still think there's a bug in bash's alias expansions, it would
> > help enormously if you could write a simple recipe for how to produce
> > the bug.  "Run these 3 commands.  The output is ___.  It should be ____."
> >
> > Anyway, here's what I get when I attempt something similar to your setup:
> >
> > unicorn:~$ bash
> > unicorn:~$ alias saveIFS='qq=qq '
> > unicorn:~$ x=y now=123.456 saveIFS IFS=. array=( $now )
> > unicorn:~$ declare -p x now qq array
> > declare -- x="y"
> > declare -- now="123.456"
> > declare -- qq="qq"
> > declare -a array=([0]="123" [1]="456")
> >
> > Or another try with two aliases:
> >
> > unicorn:~$
> > exit
> > unicorn:~$ bash
> > unicorn:~$ alias saveIFS='_save="$IFS" '
> > unicorn:~$ alias restoreIFS='IFS="$_save" '
> > unicorn:~$ now=123.456 saveIFS IFS=. array=( $now ) restoreIFS
> > unicorn:~$ declare -p now array
> > declare -- now="123.456"
> > declare -a array=([0]="123" [1]="456")
> >
> > I guess that's ... correct?  Maybe?  Is that what you expected to see?
> > I honestly can't even tell.  Your "alias expansion to an assignment
> > (with trailing whitespace) in the middle of an assignment so that the
> > syntax is completely different from what it looks like" construct is
> > so incredibly arcane, cryptic and obtuse that I have no idea what is
> > supposed to be happening.
> >
> > Do you get something different?  If so, what do you get?
> >
> > Can you show us a terminal session INCLUDING SHELL PROMPTS which starts
> > from a vanilla interactive bash instance, with NOTHING being brought
> > in from dot files, which shows behavior that you believe is wrong?
> > Set up the aliases and the variables, and then run the commands that
> > produce the output you don't like.  Then paste the whole thing into an
> > email.
> >
> > If the erroneous output only happens when you have things stuffed into
> > PROMPT_COMMAND or PS1 or DEBUG traps, and not when you type normal
> > commands into a normal shell, then that's also important information.
> > In that case, show us a vanilla bash session in which you set the aliases
> > and then set the PROMPT_COMMAND variable and so on.  Don't bring it in
> > from a dot file, because that's too hard for us to understand.  We can't
> > SEE it.  We need to be able to see it.
> >
> > Use "bash --norc" if you have to, to get a clean starting point.
> >



reply via email to

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