Every time I open terminal it says:

bash: =: No such file or directory

What would cause this?

  • 3
    Do you have a custom ~/.bashrc or ~/.profile, or did you install something new right before this started happening? – dobey Nov 17 '17 at 17:36
  • 3
    Welcome to Ask Ubuntu! Please edit your question and add the content of each your ~/.bashrc and ~/.profile using the formatting tools. – dessert Nov 17 '17 at 17:41
  • 2
    You probably have space between variable name and = sign. Please remember that variable assignment in bash must be without spaces, like var="variable value can have spaces, but assignment cannot" – Sergiy Kolodyazhnyy Nov 17 '17 at 18:00
  • 1
    Yes, i edited ~/.bashrc file and install some software on my ubuntu before this happen – Akma Nov 17 '17 at 18:24
  • 2
    Well then just show us what you did and we'll tell you what's wrong. However, chances are Sergiy the visionary already got it right… ;) – dessert Nov 17 '17 at 18:57

The problem was that I edited my `.bashrc file and added a source variable:

source = /etc/environment

Variable assignment in bash must be without spaces. Editing it to:


solved the problem

  • In two days you can please accept this as answer, so this Q&A does not linger as unanswered. – Videonauth Nov 18 '17 at 18:17
  • 1
    I am curious about why you wanted to assign this variable, because sometimes we want to source /etc/environment... If you feel like explaining further, please do. In any case, well done for fixing your problem – Zanna Nov 18 '17 at 18:22

The error that you see has two main reasons for existence.

  1. You have spaces between variable name and variable assignment. Proper sytax is to have variable="some value"

  2. Your variable is named source. source is actually a shell built-in command. Exactly because you had space between source and = the first word in the line was considered a command by the shell.

    $ bash -c 'source = "something"'
    bash: =: No such file or directory

    Because source is bash built-in command , you see bash mentioned in the error. Compare this for example with another command:

    $ bash -c 'stat = "something"'                                                                                                                                   
    stat: cannot stat '=': No such file or directory
    stat: cannot stat 'something': No such file or directory

    Please note that the core of the issue is that line is interpreted as command with positional parameters given. It doesn't mean that variable name is incorrect and in fact you could use those variable names ( even though I'd say it's a poor practice to use names of variables similar to existing command names, but that's just my opinion):

    $ bash -c 'stat="something";echo "$stat"'
    $ bash -c 'source="something";echo "$source"'                                                                                                                       

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.