LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-12-2009, 09:13 PM   #1
ibwew
LQ Newbie
 
Registered: Mar 2008
Posts: 25

Rep: Reputation: 5
Slackware bash profile


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.

Thanks
 
Old 09-12-2009, 09:21 PM   #2
rutrow
LQ Newbie
 
Registered: Sep 2009
Distribution: Debian
Posts: 20

Rep: Reputation: 1
.profile in your home directory.
 
Old 09-12-2009, 09:30 PM   #3
ibwew
LQ Newbie
 
Registered: Mar 2008
Posts: 25

Original Poster
Rep: Reputation: 5
rutrow

Thanks for the quick response.

That file doesn't exist on my system. If I

vi /home/ibwew/.profile

it opens a new, empty file. I need to add to an existing file.
 
Old 09-12-2009, 09:39 PM   #4
rutrow
LQ Newbie
 
Registered: Sep 2009
Distribution: Debian
Posts: 20

Rep: Reputation: 1
That is fine, just create a new one.
 
Old 09-12-2009, 09:56 PM   #5
ibwew
LQ Newbie
 
Registered: Mar 2008
Posts: 25

Original Poster
Rep: Reputation: 5
OK....will do!

I was looking for an existing file. One which had all my Bash paramaters such as my PATH...etc
 
Old 09-12-2009, 10:23 PM   #6
rutrow
LQ Newbie
 
Registered: Sep 2009
Distribution: Debian
Posts: 20

Rep: Reputation: 1
You can also look at /etc/profile.
 
Old 09-12-2009, 10:35 PM   #7
ibwew
LQ Newbie
 
Registered: Mar 2008
Posts: 25

Original Poster
Rep: Reputation: 5
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.

Many thanks for all the help!!!

ibwew
 
Old 09-13-2009, 03:17 AM   #8
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hi together,

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.

Markus
 
1 members found this post helpful.
Old 09-13-2009, 03:51 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
See the GNU Bash Reference Manual's section on Bash Startup Files
 
Old 09-13-2009, 08:44 AM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

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.
 
Old 09-13-2009, 12:36 PM   #11
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Perhaps the following will help:

Harmonizing the Bash Startup Scripts
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Profile ...... babujd Linux - Newbie 16 07-23-2009 06:25 PM
screen bash profile? true_atlantis Linux - Software 3 06-26-2009 01:45 PM
bash and user profile maxoo Slackware 1 08-05-2004 06:19 AM
/etc/profile vs. /etc/bash.bashrc jbrashear Debian 3 03-11-2004 03:49 PM
where is my bash profile? bandofmercy Linux - General 3 04-08-2003 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration