Seing how there has been a number of questions about editing the
environment recently, I remembered I made a function that some might
find useful. It allows you to edit the environment of the current shell
in an editor - the value of EDIT is used as the name of the editor, or
vi if it isn't set. It's a very simple function and somebody could
probably add some bells and whistles, but it works very well as it is.
Just run the following (eg. from your .profile) - the command to run to
edit the environment is 'envi':

# Edit the environment in an editor. This function dumps all
# environment variables into a file .env in the users home
# directory and opens this file with an editor. The editor is
# vi by default, but another editor can be specified in the
# environment variable EDIT. When the editor exits, the variables
# are all reexported.

function envi
{
  env > ~/.env
  if [[ -n $EDIT ]] && [[ -x $EDIT ]]
  then
    eval $EDIT ~/.env
  else
    vi ~/.env
  fi
  while read l
  do
    if (eval export '"$l"' 2> /dev/null)
    then
      eval export '"$l"'
    fi
  done < ~/.env
}




-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to