SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need to add some environment variables to my bash profile for an online programming course I've subscribed to. I've been looking for hours trying to find the file I need to edit. Can someone tell me the full path to the file I need to edit. For example
vi ./which/file/do/I/edit
It's a hidden file from what I've been able to find out.
OK....maybe I will later but this works!!
I created the file to read "echo hello ibwew" and I see that now when I log in...so I can put my new environment variables there and it should work.
I'd not recommend to insert such environment-variables in /etc/profile because the /etc/profile is only for settings which belong to all users of the system.
bash when it starts reads at first the /etc/profile and then, if existing the .profile in the home-directory. You may write the settings you'll need into an empty file named .profile and bash will read it when it starts.
Be aware, that you'll have to distinguish if bash starts as a login-shell or not. If not so, bash reads the .bashrc in your home-directory. Be sure to create also a .bashrc if necessary.
You could setup a .bashrc & .bash_profile for your user or yourself;
Code:
sample .bash_profile;
~$ cat .bash_profile
# .bash_profile
#08-30-06 12:21
#
# Source .bashrc
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Code:
sample .bashrc;
:~$ cat .bashrc
#.bashrc
#08-30-06 12:20
# Add bin to path
export PATH="$PATH:/sbin:/usr/sbin:$HOME/bin"
#export PATH="$PATH:$HOME/bin"
# Dynamic resizing
shopt -s checkwinsize
# Custom prompt
#PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
#08-29-06 11:40
if [ `id -un` = root ]; then
PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '
else
PS1='\[\033[1;32m\]\h:\w\$\[\033[0m\] '
fi
#
# Add color
eval `dircolors -b`
# User defined aliases
alias cls='clear'
alias clls='clear; ls'
alias ll='ls -l'
alias lsa='ls -A'
alias lsg='ls | grep'
alias lsp='ls -1 /var/log/packages/ > package-list'
alias na='nano'
alias web='links -g -download-dir ~/ www.google.com'
#08-29-06 11:50
#To clean up and cover your tracks once you log off
#Depending on your version of BASH, you might have to use
# the other form of this command
trap "rm -f ~$LOGNAME/.bash_history" 0
#The older KSH-style form
# trap 0 rm -f ~$LOGNAME/.bash_history
The .bashrc is very useful! I like to setup conditional within the '.bashrc' to define user or root but use the 'bash_profile to insure that '.bashrc' is present.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.