bash: export: `/home/mohin/.bashrc': not a valid identifier - terminal

When I Open my terminal, it showing this line.
bash: export: `/home/mohin/.bashrc': not a valid identifier
mohin#mohin:~$
I am using Ubuntu 16.04.
I used this line of commend after that I am facing this trouble
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
I got this line from MEDIUM Post at the following link
https://medium.com/#rgdev/how-to-install-laravel-5-4-on-ubuntu-16-04-from-scratch-quickly-29375e18e7ca
I need to solve it. Please help me.

I just fix this issue by the following process.
I did this commend:
mohin#mohin:~$ grep -i export ~/.bashrc
After That, It shows the following info
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="$HOME/.composer/vendor/bin:$PATH" source /home/mohin/.bashrc
export PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
over here I got the issue. I mean this line -
export PATH="$HOME/.composer/vendor/bin:$PATH" source
/home/mohin/.bashrc
I open .bashrc and remove this line by the following command -
sudo nano /home/mohin/.bashrc
That's it. issue fix.

Related

$ mvn -v – command not found

I installed Maven on macOS 10.12.6.
Added environment to .bash_profile file:
export PS1="\h --- \t *************************** \w $ "
export JAVA_HOME=$(/usr/libexec/java_home)
export MAVEN_HOME=/Users/{user}/Documents/Path/Maven/maven_3.3.9
export GRADLE_HOME=/Users/{user}/Documents/Path/Gradle/gradle_6.1.1
export PATH=$PATH:$MAVEN_HOME/bin
export PATH=$GRADLE_HOME/bin:$PATH
After that I save it and set source .bash_profile command in Terminal.
When I try in Terminal input mvn -v command I see:
-bash: mvn: command not found
When I input $MAVEN_HOME I see:
: No such file or directory/Path/Maven/maven_3.3.9
If I use echo $MAVEN_HOME command I see:
/Users/{user}/Documents/Path/Maven/maven_3.3.9
If I input this mvn I see:
-bash: mvn: command not found
JDK on Mac - $JAVA_HOME command in Terminal:
-bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home: is a directory
Can you help me please to understand where I missed.
Thank you very much for your answers, I fixed my problem just like that:
export PATH=/Users/{user}/Documents/Path/Maven/maven_3.3.9/bin:$PATH
After that everything worked as expected.
If you think my method is not good, please tell me why?
Since it is a maven 2+, export M2_HOME (see "What is the difference between M2_HOME and MAVEN_HOME")
And double check what echo $PATH returns after sourcing the .bashrc.
Make sure it:
includes $M2_HOME/bin
ls $M2_HOME/bin does exists.
Check this
1) Review your path, I think you are missing '$' character right before {user}
2) Review execution permission for 'maven_3.3.9/bin/mvn'
3) Make sure you are using Bash as Unix shell (and not zsh or another)
echo $SHELL
# output should look like: '/bin/bash'
4) If you are using bash then add maven's ENV variables to the file ~/.bashrc (or ~/.zshrc if you are using zsh)
5) 'source' your configuration
source ~/.bashrc
Notes
I recommend understand differences between .bashrc and .bash_profile: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
If you want to keep your configuration on .bash_profile then just rebooting your system should be enough (to start a login shell which load .bash_profile)

Trying to install hadoop on a Linux system, getting error while editing .bashrc file

I am installing hadoop in my system while trying to make permanent .bashrc changes using --source ~/.bashrc getting the error below:
/home/tcs/hadoop>source ~/.bashrc
ksh: .[5]: .[35]: shopt: not found [No such file or directory]
ksh: .[5]: .[46]: shopt: not found [No such file or directory]
ksh: .[5]: .[65]: [: argument expected
the .bashrc file content is
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
export HADOOP_INSTALL=/home/tcs/hadoop
export PATH=$PATH:$HADOOP_INSTALL/bin
export PATH=$PATH:$HADOOP_INSTALL/sbin
export HADOOP_MAPRED_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_HOME=$HADOOP_INSTALL
export HADOOP_HDFS_HOME=$HADOOP_INSTALL
export YARN_HOME=$HADOOP_INSTALL
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_INSTALL/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_INSTALL/lib"
There should be a respective rc file for ksh that you need to edit instead.
And if you find it, note that bash and ksh have slightly different syntaxes, but that shouldn't be an issue if you are only exporting environment variables
Also, latest versions of Hadoop do not support Java 6, so you'll need to update the Java home variable
It seems you run ksh (Korn-shell) environment. According to the .kshrc:
The $HOME/.kshrc file is a shell script that customizes the Korn-shell
environment. This .kshrc script often contains a list of environment
variables, command aliases, and function definitions that customize
the Korn-shell environment.
You can add your EXPORT statements to the .kshrc file as they are. The issue you see is with the script located in the /etc/bashrc file.
Or as an alternative, use bash instead. Simply run /bin/bash for a one time use. Or set it up as a default shell via chsh -s /bin/bash. You must log out and log back in to see this change.

Using 'cd' in terminal prints syntax error

I'm getting extra output on the command line when changing directories in terminal. The output is:
Casey-MacBook-Pro:~ casey$ cd Envs
-bash: command substitution: line 9: syntax error near unexpected token `done'
-bash: command substitution: line 9: ` done'
Caseys-MacBook-Pro:Envs casey$
Any idea on what is causing this? Could it be something in my bash profile? This is what my bash profile looks like when I run subl ~/.bash_profile:
# MacPorts Installer addition on 2013-03-02_at_20:37:40: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/activate.sh
# MacPorts Installer addition on 2015-09-24_at_12:31:24: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
export STORMPATH_API_KEY_ID=""
export STORMPATH_API_KEY_SECRET=""
export SENDGRID_API_KEY=""
export SECRET_KEY=""
export FLASK_CONFIG=""
export DEV_DATABASE_URL=""
export TEST_DATABASE_URL=""
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
Sounds like the problem is that virtualenvwrapper.sh is redefining cd into something broken.
Try commenting these out from ~/.bash_profile and opening a new Terminal window.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
source /usr/local/bin/virtualenvwrapper.sh
source /usr/local/bin/activate.sh

-bash: : command not found when launching the shell in Mac OSX

Lately I tried to made some changes to paths in my .bash_profile.
After I tried to validate these changes with source .bash_profile and got -bash: : command not found, I have also noticed that when I open the shell, before the execution of any command, it stands already "-bash: : command not found"...
Obviously, changes made to .bash_profile weren't taken into consideration by the system niether...
Please, help! I guess that I messed with the .bash_profile too much, have no idea how to fix it...
Contents of .bash_profile:
cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH=/Users/usrname/TreeTagger/cmd:$PATH
export PATH= /Users/usrname/TreeTagger/bin:$PATH
export UIMA_HOME= $/Users/usrname/apache-uima
export PATH=$PATH:$UIMA_HOME/bin
export HEIDELTIME_HOME='/Users/usrname/Downloads/heideltime-kit/'
export TREETAGGER_HOME='/Users/usrname/TreeTagger'
source $HEIDELTIME_HOME/metadata/setenv
Updated contents of .bash_profile:
cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH="/Users/usrname/TreeTagger/cmd:$PATH"
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
export UIMA_HOME="/Users/usrname/apache-uima"
export PATH=$PATH:$UIMA_HOME/bin
export HEIDELTIME_HOME="/Users/usrname/Downloads/heideltime-kit/"
export TREETAGGER_HOME="/Users/usrname/TreeTagger"
source $HEIDELTIME_HOME/metadata/setenv
Full shell output after last quotes' correction:
Last login: Thu Jul 31 19:07:05 on ttys000
-bash: : command not found
usr:~ usrname$ cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH="/Users/usrname/TreeTagger/cmd:$PATH"
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
export UIMA_HOME="/Users/usrname/apache-uima"
export PATH="$PATH:$UIMA_HOME/bin"
export HEIDELTIME_HOME="/Users/usrname/Downloads/heideltime-kit/"
export TREETAGGER_HOME="/Users/usrname/TreeTagger"
source $HEIDELTIME_HOME/metadata/setenv
usr:~ usrname$ source .bash_profile
-bash: : command not found
Edit with echo commands:
cat .bash_profile
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
##
# MacPorts Installer addition on 2014-03-24_at_12:05:55: adding an appropriate PATH variable for use with MacPorts.
### Your previous /Users/usrname/.bash_profile file was backed up as /Users/usrname/.bash_profile.macports-saved_2014-03-24_at_12:05:55
##export PATH="/Users/usrname/anaconda/bin:$PATH"
# added by Anaconda 1.9.1 installer
##Additional binary folders
export PATH="/Users/usrname/TreeTagger/cmd:$PATH"
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
export UIMA_HOME="/Users/usrname/apache-uima"
export PATH="$PATH:$UIMA_HOME/bin"
export HEIDELTIME_HOME="/Users/usrname/Downloads/heideltime-kit/"
export TREETAGGER_HOME="/Users/usrname/TreeTagger"
echo before
source $HEIDELTIME_HOME/metadata/setenv
echo after
usr:~ usrname$ source .bash_profile
-bash: : command not found
usr:~ usrname$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
Edit +bash version:
echo $BASH_VERSION
3.2.51(1)-release
usr:~ usrname$ source ./.bash_profile
-bash: : command not found
Edit +after set -x was added to .bash_profile:
usr:~ usrname$ source ./.bash_profile
++ $'\016'
-bash: : command not found
++ update_terminal_cwd
++ local 'SEARCH= '
++ local REPLACE=%20
++ local PWD_URL=file://usr.local/Users/usrname
++ printf '\e]7;%s\a' file://usr.local/Users/usrname
This line:
export PATH= /Users/usrname/TreeTagger/bin:$PATH
is the problem. In a variable assignment, including an export, you can't have spaces around the =. With the added space, it sets $PATH to the empty string.
Change it to:
export PATH=/Users/usrname/TreeTagger/bin:$PATH
For safety, you should add double quotes:
export PATH="/Users/usrname/TreeTagger/bin:$PATH"
just in case there are any special characters in the value of $PATH.
You have the same problem with UIMA_HOME.
UPDATE :
Based on later comments, you appear to have a stray control character in your .bash_profile. With set -x it's displayed as $'\016'. bash tries to treat that as a command name, and not surprisingly is unable to find it. Edit your .bash_profile and delete that character.
(The other errors needed to be corrected anyway.)

add command to path in OSX Mavericks

I'm trying to add a variable to my path in my OSX Mavericks using ~/.bash_profile, but when I type it, I get this error:
-bash: /Users/MyUser/.bash_profile: No such file or directory
I've read somewhere that in Mavericks it's done in a different way.
Anyone knows how to do this?
I am using ._bash_profile and .bashrc on Maverick, this work well.
If it does not exist, you can create and edit it using, vim, emacs or any editor.
$ touch ~/.bash_profile
$ open ~/.bash_profile -a "TextEdit"
This is my .bash_profile, the second line (export PATH) is what you are looking for.
# 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
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
See, it works ! Ahahah goo.gl/eDBVD0

Resources