ngo
ngo

Reputation: 15

Terminal cannot find bashrc file when using source command

I recently downloaded mysql. What am I doing wrong when I source the bash file?

The path for my bashrc file is:

Users/Name/bashrc

(I moved it from a different location, can't remember from where, but I figure that if the path is right, it shouldn't matter)

In the terminal, I'm supposed to use:

source ~/.bashrc 

When I type that and press enter, it returns:

-bash: /Users/Name/.bashrc: No such file or directory

The bash file itself says:

source /etc/bash.bashrc
source ~/.bashrc
export PATH=$PATH:/usr/local/mysql/bin

Upvotes: 0

Views: 21947

Answers (1)

jeremysprofile
jeremysprofile

Reputation: 11435

You need to have the file .bashrc located in ~ to be able to source it. ~ expands to $HOME (/Users/Name in your case).

If the output of cd ~ && ls -la doesn't contain .bashrc, then you don't have that file, so you cannot source it.

Based on your comments, your file is ~/bashrc.sh (not a great name). If you delete the first two lines of this file, it will work properly. Note that you'll have to source this file every time you open a new terminal. You can add the line

export PATH=$PATH:/usr/local/mysql/bin 

to a file that gets automatically sourced upon login, like ~/.bash_profile, /etc/bash.bashrc (not recommended), or create a ~/.bashrc and include that line.

Upvotes: 2

Related Questions