ROS_PACKAGE_PATH issue. Need help in setting .bashrc - bash

I have added
export ROS_PACKAGE_PATH="/home/kathir/ORB_SLAM":${ROS_PACKAGE_PATH}
in .bashrc and I am getting this error during cmake of ORB_SLAM.
ORB_SLAM cloned path : "/home/kathir/ORB_SLAM"
I have another workspace in "/home/kathir/catkin_ws/devel/setup.bash" in the .bashrc since I was using ROS for ARDRONE.
CMake Error at /opt/ros/indigo/share/ros/core/rosbuild/private.cmake:102 (message):
[rosbuild] rospack found package "ORB_SLAM" at "", but the current
directory is "/home/kathir/ORB_SLAM". You should double-check your
ROS_PACKAGE_PATH to ensure that packages are found in the correct
precedence order.
check below for further info
kathir#kathir-VirtualBox:~/ORB_SLAM/build$ source .bashrc
bash: .bashrc: No such file or directory
kathir#kathir-VirtualBox:~/ORB_SLAM/build$ $ROS_PACKAGE_PATH
bash: /opt/ros/indigo/share:/opt/ros/indigo/stacks:M$:: No such file or directory

The error you are likely seeing is because of your exported variables not taking effect in your current shell. You need it to source it in the current shell for it to take effect,
source ~/.bashrc
or more simply just
. ~/.bashrc
which imports all the new environment variables to the existing session. You don't have do this for subsequent sessions, as this will be sourced for every new session opened upon startup.

source ~/.bashrc should be used to make the package path effective

if you have add the path and write it to the .bashrc, you can:
run the script: source ~/.bashrc as said by the other answer;
or reopen the terminate, next everytime you open terminal, the script will run automatically

Related

Command can't be found in zsh on windows

I'm trying to complete configuration of zsh. When I run commands in git-bash, it's OK. However, the error "zsh: command not fount" is reported when I run these commands in zsh itself. Then I check the file ".zshrc" and find the path exported may get wrong.
export PATH=$HOME/bin:/usr/local/bin:$PATH
These files are located in another directory but not in "$HOME". But I don't know how to alter the line.

Warning on git bash start "bash: C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh: No such file or directory"

Whenever I open git bash I get the following warning:
bash: C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh: No such file or directory
The problem is that I uninstalled Anaconda, because I installed independent python, which resulted in giving that error.
How to remove this Warning.
Check the content of ~/.bashrc (which was mentioned here)
Maybe that (or ~/.profile, mentioned here) includes a command for that old uni uninstalled program.
Remove those lines, and try to open again a git bash session.
To remove that warning, simply erase the file path string in the .bashrc file using nano command. Here's how:
Steps to remove that warning:
Open Git Bash and check .bashrc location by typing ~/.bashrc into git bash.
Navigate to folder where .bashrc file is located.
Type nano .bashrc
Erase the string that says C:/Users/RS3/Anaconda3/etc/profile.d/conda.sh
Press ctrl+O to save .bashrc file and then ctrl+X to exit.
When you reopen git bash nothing should appear because .bashrc doesn't have that path in it anymore. Also, if conda commands were working before it will still continue to work after erasing this.

Local .bashrc is not read on startup under MobaXterm Home on Windows

I am using MobaXTerm (Home version 3.0). I have create a direcorty C:\MobaXterm_3.0\home and set in the local configuration (Settings --> Configuration) the home directory to this path. Under this path I have created a .bashrc file with read access for everybody.
However when starting up MobaXterm, the .bashrc file does not get executed. How can I fix this? The MobaXterm docu says that in the Home addition I cannot change the /etc/profile, but the standard /etc/profile does execute ~/.bashrc. So I am a bit at a loss.
ps: I am aware of the answer to "How does one define aliases for use within MobaXTerm local bash shell?" and have created the .bashrc file with the right permissions.
When you launch a local terminal in MobaXterm first time .bash_profile is executed which sets up the required configuration for the initial shell command prompt to work. The idea is to source the .bashrc from the .bash_profile.
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
Add the above lines to your .bash_profile.
Source: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

How to add a directory to PATH in the file .bashrc?

After installing python(EPDFee), I want to add the /bin directory to $PATH variable. I am use bash shell. I have found that I have to add the following line in the file .bashrc
export PATH=/home/usrname/epd/bin:$PATH
I have found the file .bashrc, it reads
PATH=$PATH:/opt/bin
# Added by Canopy installer on 2014-03-29
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
VIRTUAL_ENV_DISABLE_PROMPT=1 source /home/an/Enthought/Canopy_64bit/User/bin/activate
Could you please tell me where can I add export PATH=/home/usrname/epd/bin:$PATH to or is should be added in another file?
add the following line to your .bashrc file ...don't forget to replace your path.
export PATH="/path/directory:$PATH"
then do
source .bashrc
to let the changes make effects. I am not sure about other distributions of Linux but It will work on CentOS and RedHat.
You can do it like this :
Define a EPD_HOME var and append it to PATH
EPD_HOME=/home/usrname/epd/bin
PATH=$PATH:$EPD_HOME:$HOME/bin
export PATH
Notice that the $EPD_HOME variable is in the PATH variable and is now loaded once you open a connection to your user on the machine.

How to remove entry from $PATH on mac

I was trying to install Sencha Touch SDK tools 2.0.0 but could not run it properly. It created an entry in the $PATH variable.
Later I deleted the sencha sdk tools folder but didn't realize that the path variable is still there.
When i did echo $PATH I got -
/Applications/SenchaSDKTools-2.0.0-beta3:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
I searched on how to remove variables from $PATH and followed these steps :
Gave the command PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
Did echo $PATH which showed /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
gave the command export PATH
Closed terminal and reopened it. Gave the command echo $PATH. This time I got
/Applications/SenchaSDKTools-2.0.0-beta3:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
Can anyone tell me what am i doing wrong?
echo $PATH and copy it's value
export PATH=""
export PATH="/path/you/want/to/keep"
Check the following files:
/etc/bashrc
/etc/profile
~/.bashrc
~/.bash_profile
~/.profile
~/.MacOSX/environment.plist
Some of these files may not exist, but they're the most likely ones to contain $PATH definitions.
On MAC OS X Leopard and higher
cd /etc/paths.d
There may be a text file in the above directory that contains the path you are trying to remove.
vim textfile //check and see what is in it when you are done looking type :q
//:q just quits, no saves
If its the one you want to remove do this
rm textfile //remove it, delete it
Here is a link to a site that has more info on it, even though it illustrates 'adding' the path. However, you may gain some insight.
What you're doing is valid for the current session (limited to the terminal that you're working in). You need to persist those changes. Consider adding commands in steps 1-3 above to your ${HOME}/.bashrc.
If you're removing the path for Python 3 specifically, I found it in ~/.zprofile and ~/.zshrc.
$PATH contains data that is referenced from actual files. Ergo, you should find the file containing the reference you want to delete, and then delete said reference.
Here is a good list to run through progressively [copied from #Ansgar's answer with minor updates].
/etc/bashrc
/etc/profile
~/.bashrc
~/.bash_profile
~/.profile
~/.MacOSX/environment.plist
/etc/paths
/etc/paths.d/
Note that /etc/paths.d/ is a directory that contains files with path references. For example, inside this directory may be a file called, say, fancy-app, and inside this file you'll see an entry like below:
/path/to/fancy-app
This path will appear in your $PATH and you can delete the entry in the file to remove it, or you can delete the file if it has only the one reference you want to remove.
Use sudo pico /etc/paths inside the terminal window and change the entries to the one you want to remove, then open a new terminal session.
when you login, or start a bash shell, environment variables are loaded/configured according to .bashrc, or .bash_profile. Whatever export you are doing, it's valid only for current session. so export PATH=/Applications/SenchaSDKTools-2.0.0-beta3:$PATH this command is getting executed each time you are opening a shell, you can override it, but again that's for the current session only. edit the .bashrc file to suite your need. If it's saying permission denied, perhaps the file is write-protected, a link to some other file (many organisations keep a master .bashrc file and gives each user a link of it to their home dir, you can copy the file instead of link and the start adding content to it)
Close the terminal(End the current session). Open it again.
If the manual export $PATH method does not seem to be working after you close the terminal and open again, definitely check the shell configuration files.
I found a small script that kept adding some more path in front of the $PATH everytime it was open.
For zsh you can check the ~/.zshrc file.

Resources