How to fix -bash: alias: vim: not found error? - bash

I am trying to install OpenCV using the follow tutorial. One of the steps involves the command: source ~/.bash_profile. Running this command gives me the following error:
-bash: alias: vim: not found
-bash: alias: =: not found
-bash: alias: vim -S ~/.vimrc: not found
I have tried to find a solution online but haven't found any related questions. How do I solve this?

You appear to have something like
alias vim = "vim -S ~/.vimrc"
in your .bash_profile, which is interpreted as a request to show the definitions for three different aliases. You need to remove the whitespace, with something like
alias vim="vim -S ~/.vimrc"

Related

How to fix the terminal "source" command on OSX Catalina

I try executing the below commands in my terminal.
$ source ~/.bash_profile or . ~/.bash_profile
and the system returns:
-bash: [[-s: command not found
I cannot think of anything extra information to provide.
I kept researching my issue and came across this stackoverflow post
I initially misunderstood the error message to mean the source command was not found. After reading the other post I tried running bash .bash_profile and the result was .bash_profile: line 11: [[-s: command not found. I had an error in my .bash_profile file. I commented out the line and tried running source .bash_profile and it worked.
The initial command not found did not relate to the source command, it related to the file I was running with source.
I hope this helps someone else.

Terminal cannot find Bash

I am a beginner coder, so bear with me. I was doing the lynda.com tutorials on Ruby on Rails and in the Terminal typed in nano .bash_profile and then export PATH="usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH". Now everytime I log in I get the message :
-bash: export: `/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin': not a valid identifier
and I even when I tried to find it using which $SHELL it says that No such file or directory. What can I do to fix this?
PATH="usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
should be
PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

Failure with creating custom alias in ubuntu 14.04

I am running Ubuntu 14.04 on my computer and I am trying to create a custom alias so that I can run the ghc (Haskell compiler).
I tried editing the .bash_aliases file and added the commands:
alias ghci1 = 'GHC_HOME=$HOME/Development/bin/ghc'
alias ghci2 = 'PATH=$GHC_HOME/bin:${PATH}'
alias ghcis = 'ghci'
The whole point of doing this is because I installed ghc 7.8.3 and everytime I want to open the ghci I have to write down the first two commands, otherwise I get the error that ghc is not installed on my computer.
When I open a terminal after having edited the .bash_aliases file I get the messages:
bash: alias: ghci1: not found
bash: alias: =: not found
bash: alias: ghci2: not found
bash: alias: =: not found
bash: alias: ghcis: not found
bash: alias: =: not found
bash: alias: ghci: not found
bash: alias: ghci1: not found
bash: alias: =: not found
What am I doing wrong? I even tried the command:
. ~/.bashrc
just in case there is something wrong with the .bash_aliases file but I get the same error message.
Also when I type in the command alias I get as a result along with the other aliases this:
alias GHC_HOME='$HOME/Development/bin/ghc'
alias PATH='$GHC_HOME/bin:${PATH}'
So my aliases don't get the names that I assigned to them. Is there a way to somehow escape the '=' character or something like that for this to work?
P.S. The guide that I used to install ghc 7.8.3 is this:
https://gist.github.com/yantonov/10083524
So is there maybe a better way to install ghc 7.8.3, or am I assigning the aliases in a wrong way?
Thank you.
You should be using the export built-in command in bash to set these up, and then GHCI will work correctly.
At the top or bottom of ~/.bashrc you should write:
export GHC_HOME=$HOME/Development/bin/ghc
export PATH=$GHC_HOME/bin:${PATH}
Then once you have started a new bash instance you will have access to ghci. (If you need to do a live change, you can also source ~/.bashrc to reload that file into bash, which will bring the needed definitions.)
remove the space before and after the '='
it should be
alias ghci1='GHC_HOME=$HOME/Development/bin/ghc'

bashrc issue in cygwin

I updated my .bashrc with following text to run ns2 and saved it.
export PATH=$PATH:/home/user/nsallinone-2.34/bin:/home/user/ns-allinone-2.34/tcl8.4.18/unix:/home/user/ns-allinone-2.34/tk8.4.18/unix
export LD_LIBRARY_PATH=/home/user/ns-allinone-2.34/otcl-1.13:/home/user/ns-allinone-2.34/lib
export TCL_LIBRARY=/home/user/nsallinone-2.34/tcl8.4.18/library
Now when i run my Cygwin, each time it displays error as:
-bash: $'\r': command not found
Even now i have removed the above text but it still gives error.
Do i have to recompile ./bashrc, if I have how i will do that?
Now when i run my Cygwin, each time it displays error as:
-bash: $'\r': command not found
It seems that you edited your .bashrc using an application that added CR to the file.
Running dos2unix would remove the CR:
dos2unix /path/to/.bashrc

bash is acting up after "rm .bashrc*"

So I am still fairly new to all of this, that is coding, OS X Snow Leopard, bash and the likes. I wanted to configure my prompt to display the current working directory. Knowing about Google I searched the web and tried a few linux bash tutorials that suggested configuring a .bashrc file, which I did and it didn't work. More googling got me to using a .profile file, which did the trick.
So wanting to keep my OS tidy I applied more of my new bash knowledge and went
rm .bashrc*
to delete the files I created. I must have been a little too thorough though, because I seem to have deleted more than I should have. When I fire up the shell now, I get a bunch of errors:
-bash: alias: dev: not found
-bash: alias: =: not found
-bash: alias: cd Downloads/Dropbox/__dev/: not found
-bash: alias: sample_app: not found
-bash: alias: =: not found
-bash: alias: cd dev/rails_projects/sample_app/: not found
The contents of my .profile is:
export PS1="\w>"
alias dev = 'cd Downloads/Dropbox/__dev/'
alias sample_app = 'cd dev/rails_projects/sample_app/'
Any idea what I can do?!
Thanks :)
You can't have spaces before and after the equality sign. This should work:
export PS1="\w>"
alias dev='cd Downloads/Dropbox/__dev/'
alias sample_app='cd dev/rails_projects/sample_app/'

Resources