Here are my .bash_profile and .profile files:
BASH PROFILE
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
export PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH="$HOME/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH"
#Virtualenvwrapper
export WORKON_HOME=$HOME/Devaus/Envs
export PROJECT_HOME=$HOME/Devaus/Envs
source /usr/local/bin/virtualenvwrapper.sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
PROFILE
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
echo $PATH
/Users/User/Devaus/Envs/wsd/bin:/Users/User/.rvm/gems/ruby-2.1.1/bin:/Users/User/.rvm/gems/ruby- 2.1.1#global/bin:/Users/User/.rvm/rubies/ruby- 2.1.1/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/User/.rvm/bin
The question is why /Applications/Postgres.app/Contents/Versions/9.3/bin won't be added to PATH? My goal is to use psqletc commands stated in here http://postgresapp.com/documentation/cli-tools.html
Bash does not automatically read .profile if you have a .bash_profile. Usually this is set up with .bash_profile explicitly loading .profile but you don't seem to have that. Maybe add this to the beginning of your .bash_profile:
test -e ~/.profile && . ~/.profile
Or alternatively put those things in your .bash_profile instead; but then if you need some or all of these settings with /bin/sh you can't do that. It is usually a better arrangement to only have specifically Bash-only code in your .bash_profile and keep your .profile portable to classic Bourne shell (which does not allow export before a variable assignment; so you have syntax error where
export variable=value
should be
variable=value
export variable
instead for portability.)
Incidentally, you only have to export once (andPATH should already be exported by the time Bash runs your personal login files, anyway).
Related
Every time I open WSL Ubuntu 18.04 on Windows 10 I want to run these settings automatically.
alias desktop='cd /mnt/c/Users/Dot/Desktop/ai_files'
export PYTHONPATH=${PYTHONPATH}:${HOME}/ai-safety-gridworlds
export DISPLAY=localhost:0.0
I tried making .sh script with the following content in /etc/init.d/ but it didn't work.
#!/bin/bash
alias desktop='cd /mnt/c/Users/Dot/Desktop/ai_files'
export PYTHONPATH=${PYTHONPATH}:${HOME}/ai-safety-gridworlds
export DISPLAY=localhost:0.0
To run these commands every time you open WSL, you will want to append the commands to .bashrc.
In bash, run
echo "alias desktop='cd /mnt/c/Users/Dot/Desktop/ai_files'" >> ~/.bashrc
echo "export PYTHONPATH=${PYTHONPATH}:${HOME}/ai-safety-gridworlds" >> ~/.bashrc
echo "export DISPLAY=localhost:0.0" >> ~/.bashrc
To create an environment variable which will be visible for all users on Ubuntu you can create a sh file in /etc/profile.d folder.
In example :
sudo vi /etc/profile.d/my_vars.sh && sudo chmod o+r /etc/profile.d/my_vars.sh
then include there your variables. For example:
export ORACLE_HOME="/opt/oracle/instantclient_11_2"
terminate and start wsl again. Variables should be accessible for all users.
I want to open my .bashrc file and and add a new PATH PHP VERSION export PATH=/opt/plesk/php/7.1/bin:$PATH;
In my root ssh connection i made : ls -a and i saw .bashrc ! but how i could open the file and add my new path ?
Sorry i'm really not a king in terms of command lines
Thanks a lot in advance if someone could help
To open file in editor you can use the following command:
vi ~/.bashrc
Or you can just add the line without opening file in editor:
echo "export PATH=/opt/plesk/php/7.1/bin:$PATH;" >> ~/.bashrc
After editing the file, run the following command (it will apply changes):
source ~/.bashrc
Also, make sure that a ~/.profile is there (sometimes it's missing). Otherwise, create it like this:
echo '[[ -f ~/.bashrc ]] && source ~/.bashrc' > ~/.profile
I'm using this command line:
xgettext -kT._ -kT._n:1,2 -kT._p:1c,2 -kT._pn:1c,2,3
-LC# --omit-header --from-code=UTF-8 -o messages.pot
-c -n -p PO ./TransClassOne.cs
Nevertheless, I'm getting this message from xgettext:
xgettext.exe: error while opening "._" for reading: No such file or directory
Any ideas?
Using MacOS:
Install gettext tool
If already installed, you might want to reinstall - brew reinstall gettext
If using some bash profile (oh-my-zsh e.g.), export gettext and update it:
nano ~/.zshrc
at the end of file add export PATH="/usr/local/opt/gettext/bin:$PATH" and save it
update profile with . ~/.zshrc ; pay attention to not forget the dot before zshrc
restart your terminal (optional)
Run your command again.
I have a project with a Makefile in it, on Unix console it works fine, compiles, builds and I can run the binary at the end.
I imported the project into Eclipse workspace and somehow Makefile module of Eclipse cannot build the project now. It gives the following error:
g++: error: /src/main: No such file or directory
Whereas there should have been
g++ -I $(APR_INCLUDE) -I $(CMS_HOME)/src/main
which uses two make variables. I already put them before this line and define them as :
export APR_INCLUDE=/usr/include/apr-1
export CMS_HOME=~/Desktop/activemq-cpp-library-3.8.4
Same Makefile is fine with console, but not with Eclipse, which is weird.
Any thoughts?
Here is where I put my export lines:
obstacleDetection_cpp: src/obstacleDetection.cpp protoc_middleman
export APR_INCLUDE=/usr/include/apr-1
export CMS_HOME=~/Desktop/activemq-cpp-library-3.8.4
g++ -I $(APR_INCLUDE) -I $(CMS_HOME)/src/main -g -o src/obstacleDetection.o -c src/obstacleDetection.cpp
cd libs && cp $(CMS_HOME)/src/main/.libs/libactivemq-cpp.so.18.0.4 . && ln -sf libactivemq-cpp.so.18.0.4 libactivemq-cpp.so.18
g++ -L $(CMS_HOME)/src/main/.libs/ -g -o bin/obstacleDetection src/obstacleDetection.o src-gen/Point.pb.cc src-gen/Point.pb.h -lactivemq-cpp -lssl -lprotobuf -pthread
#echo "Success. Run the executable from the binary directory with: LD_LIBRARY_PATH=../libs/ ./obstacleDetection"
This is not right:
obstacleDetection_cpp: src/obstacleDetection.cpp protoc_middleman
export APR_INCLUDE=/usr/include/apr-1
export CMS_HOME=~/Desktop/activemq-cpp-library-3.8.4
g++ $(APR_INCLUDE) -I $(CMS_HOME)/src/main ...
All lines in the recipe (that is, lines that are indented with a TAB in a target context like this) are passed to the shell. These are not make variable assignments. There are two things wrong with that:
First, each logical line in the recipe is passed to a new shell. That means any changes to the process context (such as the environment or the working directory) are present only for the duration of that logical line; once the shell processing that line exits, all those changes are lost. So, these lines have no impact: they set an environment variable in the shell, then the shell exits and that setting is gone.
Second, the variable references you make in your compile line, such as $(APR_INCLUDE), are make variable references, not environment variable references. So even if those environment variable assignments still had effect, they would not be used because you're not referring to environment variables here.
You want to create make variable assignments. That can only be done outside of a recipe. Also, you don't need to export them because only make needs to see them (make will expand them before invoking the shell). So, your makefile should look like this:
APR_INCLUDE = /usr/include/apr-1
CMS_HOME = $(HOME)/Desktop/activemq-cpp-library-3.8.4
obstacleDetection_cpp: src/obstacleDetection.cpp protoc_middleman
g++ -I $(APR_INCLUDE) -I $(CMS_HOME)/src/main -g -o src/obstacleDetection.o -c src/obstacleDetection.cpp
cd libs && cp $(CMS_HOME)/src/main/.libs/libactivemq-cpp.so.18.0.4 . && ln -sf libactivemq-cpp.so.18.0.4 libactivemq-cpp.so.18
g++ -L $(CMS_HOME)/src/main/.libs/ -g -o bin/obstacleDetection src/obstacleDetection.o src-gen/Point.pb.cc src-gen/Point.pb.h -lactivemq-cpp -lssl -lprotobuf -pthread
#echo "Success. Run the executable from the binary directory with: LD_LIBRARY_PATH=../libs/ ./obstacleDetection"
I'm trying to add java_home in linux machine (centos 5.8)
I'm adding this part to setting JAVA_HOME and PATH for all users in my machine
vi /etc/profile
export JAVA_HOME=/opt/jdkx.x.x_xx
export PATH=$PATH:$JAVA_HOME/bin
after seting it up, i try to verify it by using echo command
echo $JAVA_HOME
but it does not give me any path.Is there something wrong with my configuration?
This method will persist OS updates
echo "export JAVA_HOME=/usr/java/default/" > /etc/profile.d/java_home.sh
If you have more then on version of java install there may be trouble.
The JAVA_HOME path is different because we often install different version JDK and maybe different places. Once a I try to find the general way. There is the result.
Firstly, to query the installed jdk package name: rpm -qa|grep java
my result is:java-1.6.0-openjdk
Secondly, to query the installed place of this package
rpm -ql java-1.6.0-openjdk
Most files is under: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/
go there to confirm it is a real JDK directory
Thirdly, execute export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/ in terminal. Or add it /etc/bashrc for all user.
Question has been edited, answer doesn't make sense anymore.
Left as a placeholder for comments.
echo $SHELL will tell you which shell you are using. Most likely /bin/bash.
Assuming bash, /etc/profile is only read for a login shell (bash --login), not just a new interactive shell.
i.e. if you
sh1% vi /etc/profile
sh1% bash # /etc/profile not read
sh2% echo $JAVA_HOME
sh2%
sh1% vi /etc/profile
sh2% bash --login # /etc/profile should be read.
sh2% echo $JAVA_HOME
/opt/blah/blah/blah
sh2%