[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Path of exported variable not set as source
From: |
alex xmb sw ratchev |
Subject: |
Re: Path of exported variable not set as source |
Date: |
Fri, 26 Jan 2024 14:44:18 +0100 |
On Fri, Jan 26, 2024, 14:29 Ricky Tigg <ricky.tigg@gmail.com> wrote:
> BASH version: 5.2.26(1)-release. OS: Fedora; Desktop edition.
>
> Hello.
>
> Current state: Vim set as default text editor.
>
> $ cat .bashrc | grep '^export EDITOR'
> export EDITOR='/usr/bin/vim'
> $ typeset -p EDITOR
> declare -x EDITOR="/usr/bin/vim"
> $ which nano
> /usr/bin/nano
>
> Failure: attempt to set a text editor as the default one of the current
> session.
>
> To reproduce in terminal
>
> $ export EDITOR='/usr/bin/nano' && source $HOME/.bashrc
> $ echo $EDITOR
> /usr/bin/vim
>
> Expected: Latest command's output to be "/usr/bin/nano" instaed of
> "/usr/bin/vim".
>
export var=${var:-default}
to make in rc keep if set
ur code says ' editor=nano <and if success> source rc '
when rc is sourced , ur version sets it always , when bash reads cmds
I unexpectedly get the desired behaviour without invoking 'source'.
>
> $ export EDITOR='/usr/bin/nano'
> $ echo $EDITOR
> /usr/bin/nano
>
> Hopefully, my interpretation of the 'source' command is correct.
>