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: Thu, 23 Sep 2021 14:35:25 +0200

sorry for top posting
.. that $whole . $frac is indeed what i was and still trying to do
however im bugged to solve why this isnt working, .. maybe another bug ?

the type of the two aliases follows, excepts there shouldnt be an ending
newline, but else look maybe u find there something

saveIFS is aliased to `__savedIFS=$( 2>&- declare -p IFS )
'
restoreIFS is aliased to `eval "${__savedIFS:-unset -v IFS}"
'

i understand you bug me for the non ifs % and # workaround u did but im
really interested big time in solving this issue

and no newlines there, just 1:1 code, two lines assignments, one empty, one
printf and the following .frac assignment

please understand i want no this work around
just like it was with the case of the aliases bug that at least in the dev
version got fixed

the ps1 looks the following

\[\e[m\]\
$? exit // $SECONDS old , static

$prptnow3 == $prptnow
\$ \u$prptid \$ @ $prpttty ( \j ) -> $PWD

$dfslist

i only see some weird bug here, .. or a typo, ..also a bug

On Thu, Sep 23, 2021, 13:30 Greg Wooledge <greg@wooledge.org> wrote:

> On Thu, Sep 23, 2021 at 10:48:46AM +0200, Alex fxmbsw7 Ratchev wrote:
> > i wrote the following code in $PROMPT_COMMAND
>
> > prptnow=$EPOCHREALTIME saveIFS IFS=. prptnow2=( $prptnow ) restoreIFS \
> > dfslist=$( prptrecents )
> >
> > printf -v prptnow3 '%(%F , %T)T' $prptnow2
> > prptnow3+=.${prptnow2[1]}
>
> This is incomprehensible.  Either it's utterly broken to begin with,
> or else your mail user agent has removed line breaks, rendering the
> code unreadable.
>
> As it's written, you have a command named "saveIFS" which is invoked
> with a temporary environment variable named prptnow.  Except that it
> cannot be invoked at all, because some of your arguments which you
> pass to it contain unquoted parentheses.
>
> unicorn:~$ x=y saveIFS IFS=. prptnow2=( $SHELL ) restoreIFS
> bash: syntax error near unexpected token `('
>
> The only way this code could work is if the prptnow2=... array assignment
> is on a separate line.  And if there are supposed to be line breaks in
> the code, then we don't know WHERE THEY ARE.
>
> Whatever you're using to send email, it's not compatible with programming
> language syntax.
>
> We also have no idea what "saveIFS" and "restoreIFS" are.  Are they
> functions?  What do they do?
>
> If the whole purpose of your code is to split the value of $EPOCHREALTIME
> at the period, you don't need array assignments and IFS changes and
> *unquoted* (!!!) parameter expansions.  You can use ${var#*.} and ${var%.*}
> instead.
>
> now=$EPOCHREALTIME
> whole=${now%.*}
> frac=${now#*.}
> printf -v prptnow3 '%(%F , %T)T.%s' "$whole" "$frac"
>
> I think that's what you were trying to do.  It's frustrating that we have
> to *guess* what you were trying to do from mangled non-working code.
>
>


reply via email to

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