Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

closed as off-topic by Iain, Sven, Jacob, dawud, Katherine Villyard Apr 5 at 21:55

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Sven, Jacob, dawud, Katherine Villyard
If this question can be reworded to fit the rules in the help center, please edit the question.

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. –  Iain Apr 5 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. –  Nickolai Leschov Apr 5 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. –  Iain Apr 5 at 20:26
    
@Iain Probably you are right; this particular question should be on U&L. –  Nickolai Leschov Apr 5 at 21:03

2 Answers 2

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

share|improve this answer

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.

share|improve this answer
    
Is it ok that /etc/environment is empty by default? –  Nickolai Leschov Apr 5 at 17:33
    
That just means that it doesn't change any environment variables. –  Håkan Lindqvist Apr 5 at 17:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.