Mick wrote:

> On Monday 02 May 2011 12:52:12 Alex Schuster wrote:
> > Mick writes:

> > > Thanks.  Not sure if there is a difference between an env.d variable
> > > and a profile.d variable.
> > 
> > None you will notice, both /etc/profile.env and scripts in
> > /etc/profile.d/ are sourced in /etc/profile. profile.env contains all
> > stuff in /etc/env.d/ after you ran env-update.
> 
> Hmm ... I initially set up a file in /etc/profile.d/99editor with
> 
> EDITOR="/usr/bin/vim"
> 
> in it.  Upon reboot I still got:
> 
> echo $EDITOR
> /bin/nano

I looked into /etc/profile, and right at the bottom it does this:

for sh in /etc/profile.d/*.sh ; do
        [ -r "$sh" ] && . "$sh"
done
unset sh

So the file needs to have the .sh suffix.

> So, I thought of moving it into /etc/env.d/97editor.  Upon another reboot
> (troubleshooting network problems) I again found out that nano is my
> default editor ... neither locations seem to being read at boot time?
> 
> Running env-update && source /etc/profile did not make any difference.
> 
> Is the number prefix important?  Does it have to be 99editor?  If so, how
> does one discover the correct number for each variable?

Maybe the 99 is what eselect wants the number to be. If you manage files in 
there yourself, I think it should not matter. The result of env-update in 
/etc/profile.env is sorted alphabetically, so the order of file in 
/etc/env.d should not matter, I think.


> > I do not manually change things in env.d, but with 'eselect editor set
> > <n>' you can create a file /etc/env.d/99editor which will set the
> > EDITOR variable to the editor you gave eselect as argument. Enter
> > eselect editor list to se what's available, or just give the editor
> > path as argument to eselect.
> 
> # eselect editor list
> Available targets for the EDITOR variable:
>   [1]   /bin/nano
>   [2]   /usr/bin/ex
>   [3]   /usr/bin/vi
>   [ ]   (free form)
> 
> What does the "[ ]   (free form)" above refer to?

That you can specify any other binary as editor if you like, with "eselect 
editor set /path/to/my/editor".

> > > I've added mine to /etc/profile.d for now.  I'll
> > > see what gives when I reboot.
> > 
> > A relogin would be enough. Or '. /etc/profile' in the shell, this is
> > what eselects suggests to do. Or bash -l, or xterm -ls.
> 
> Yep, setting the EDITOR using eselect works fine.

Hooray!

        Wonko

Reply via email to