Source ~/.bash_profile returns -bash: w#: command not found

When updating my .bash_profile file after placing my mongo enterprise directory in my home directory, I attempted to run the command source ~/.bash_profile so as to not have to restart the Terminal to check echo $PATH, but the Terminal responded with -bash: w#: command not found.

Here is my current .bash_profile:

# Enable tab completion
source ~/git-completion.bash

# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"

# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"

# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc

alias subl="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

# mysql?
export PATH=${PATH}:/usr/local/mysql/bin/
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# for mongodb?
export MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin

export PATH="~/mongodb-osx-x86_64-enterprise-4.0.5/bin:$PATH"

Hi Damon_Bolesta_86576,

Are you still facing trouble for this? As I have seen other post and replied there.
Let me know if you still need help.

Kanika

Hi Kanika,

Yes, my bash command still seems to not be working, as described in my original post here. In my other post, I was only able to get it working by restarting the terminal.

That’s perfectly fine then, isn’t it? You were going to logout or reboot at some point anyway :wink:

That is true! However, I’m more concerned that such a simple bash command seemed to have failed, when it worked without error for the instructor. I imagine this means there is a deeper problem. What if I need to use a bash command in the future that can’t be skirted with a terminal restart?

The odd thing is: I don’t see anything in that .bash_profile that could lead to the error message :smiley: Nothing that would start with w and end in \#.

The fact that the profile runs fine after restarting your terminal (which literally just starts Bash as well) suggests that there is not some underlying issue.

I notice you’re sourcing a bunch of other setup shell scripts; maybe it’s tucked away in there somewhere.

So, just to be sure, if you now run:

. ~/.bash_profile

… there’s no errors. Right?

10%20PM

Unfortunately, it still tells me command not found :sweat:

A lot of of my .bash_profile setup was edited through various tutorials I’ve followed over the years, so I’m not positive if something that I added a while ago is messing this up.

1 Like

The only command that’s not found is “w#”. I have no idea where it’s pulling that from :slight_smile: The profile itself is run just fine.

I appreciate your attempts to help Tess :smiley:

I know it’s too late, but I faced similar issue and got it resolved by adding mongo bin PATH to “paths” textedit file sitting under “/etc” folder. you can take reference from below post which do not require creating a new .bash_profile on OSX

https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/#.Uydjga1dXDg