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: Chet Ramey
Subject: Re: i cant see whats the issue, .. ps1 + propt command + date
Date: Sat, 25 Sep 2021 16:46:09 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

On 9/25/21 3:09 PM, Alex fxmbsw7 Ratchev wrote:

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

It's not a bug in bash, and it doesn't have anything to do with whether
or not the aliases end in spaces.

All of this crap ends up as

now=$EPOCHREALTIME _s=$( declare -p 2>&- IFS ) IFS=. now2=( $now ) eval "${_s:-unset -v IFS}" ; declare -p now2

All of the assignment statements preceding the `eval' are part of the
temporary environment and do not persist beyond that command. It's just
that simple.

It might be a useful exercise to think about how your alias farm expands
and what the shell actually sees when it goes to execute the command.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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