-3

Say, I would like to change my editor system-wide to nano. I was doing this with

echo 'export EDITOR=/usr/bin/nano' >> /etc/bashrc

As I learned, it was a bad idea, because if you accidentally omit one >, you will overwrite bashrc and won't be able to log in. In addition to being error-prone, is this in any other way a bad idea and which way is better?

4
  • 2
    I've said it before but I'll say it again. You are way out of your depth. You need education (which is not our mission), not a Q&A site. Please spend considerably more time researching what you want to do before asking.
    – user9517
    Apr 5, 2014 at 19:23
  • @Iain Is there anything wrong if this question will be properly answered on a public Q&A site? I can see here only public benefit, as well as my education. Apr 5, 2014 at 20:09
  • 1
    Sad, harsh and true, cluelesness demonstrated on the scale that you do, devalues the site for the professionals that it is intended for. You are way over your head, perhaps U&L or SU may be better places for you to ask your questions.
    – user9517
    Apr 5, 2014 at 20:26
  • @Iain Probably you are right; this particular question should be on U&L. Apr 5, 2014 at 21:03

2 Answers 2

4

Actually edit the file with an editor like nano, or vim.

4

You can add system-wide environment variables in the file /etc/environment instead of adding commands to /etc/bashrc.

The entries would then be like

FOO=bar
BAZ=quux

The rest of your question pretty much comes down to "how to edit a file without messing it up", which to some degree comes down to personal preference.

2
  • Is it ok that /etc/environment is empty by default? Apr 5, 2014 at 17:33
  • That just means that it doesn't change any environment variables. Apr 5, 2014 at 17:34

Not the answer you're looking for? Browse other questions tagged .