Beginner here with what I hope is a simple question!

I entered 'exort' rather than 'export' when creating a new environmental variable using the terminal and now every time I open a new terminal window I see the following:

$ -bash: exort: command not found

I have looked at the environmental variables saved to my bash profile (~/.bash_profile) and the one with the typo is on the penultimate line:

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load 
RVM into a shell session *as a function*
export SEASON=winter
exort ANOTHERVAR=salut
export ANOTHERVAR=salut

I tried to run


but it didn't seem to remove ANOTHERVAR.

Would appreciate any suggestions on how I can remove ANOTHERVAR and delete this line from the terminal window.

Thank you very much

  • 3
    What's your question? You already got to the bottom of the problem, identified the erroneous line and (as it seems) even wrote a second one correcting it, what's the problem? You should just remove the exort line from the file and you're good to go. – dessert Jan 2 '18 at 18:54
  • 2
    when you say "bash profile" do you mean ~/.bash_profile? If so, why did you create that file? Normally you'd add local environment variables to ~/.profile, which will not be read if ~/.bash_profile exists. If you don't mean ~/.bash_profile, what file are you talking about? – Zanna Jan 2 '18 at 18:54
  • Zanna, dessert: It might be that the OP added the lines via echo "export ANOTHERVAR=salut" >> ~/.bash_profile (or whatever file) and now doesn't know how to remove them. – PerlDuck Jan 2 '18 at 19:02
  • Thank you so much everyone! Yes, @PerlDuck that is how I added the line. I was just missing the last step of removing the line from the file which I've now corrected. – Serena Jan 2 '18 at 19:03
  • So which file was it? We're just curious. – PerlDuck Jan 2 '18 at 19:05

Fix typo export instead of exort in your ~/.bashrc:

export ANOTHERVAR=salut

with your favorite text editor such as gedit ~/.bashrc.

Or you could use sed in this way:

sed -i 's/exort/export/' ~/.bashrc
  • The option -i means make the changes in place within the file ~/.bashrc.
  • The command s/ means substitute the first string with the second one; / is a delimiter.
  • 1
    @Serena If this answer solved your issue, please take a moment and accept it by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites. – dessert Jan 2 '18 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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