LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-26-2013, 03:52 PM   #1
Kb3lnp
LQ Newbie
 
Registered: Jul 2013
Posts: 4

Rep: Reputation: Disabled
Add to path


Question about slackware 14, where do you make changes to the PATH, I want to add /home/bin starting to learn script programming and I want to store my programs in bin and execucute them from my home directory. I tried to use export PATH =PATH:/home/bin that did not work.
 
Old 10-26-2013, 04:04 PM   #2
Robhogg
Member
 
Registered: Sep 2004
Location: Old York, North Yorks.
Distribution: Debian 7 (mainly)
Posts: 653

Rep: Reputation: 97
It would need to be export PATH=${PATH}:/home/bin - in the shell, you use the variable name (naked) to assign, but you need the $ symbol to access the variable's value.

If you wanted to make the change permanent, you could add the statement to the .profile file in your home directory.
 
Old 10-26-2013, 04:04 PM   #3
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,376

Rep: Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937Reputation: 937
I think you are missing a $ in front of the second PATH. Try this:

Quote:
PATH =$PATH:/home/bin
That will set it temporarily. To make it permanent, add the line to your ~.bashrc file.

Test it first. Then add it to .bashrc.
 
Old 10-26-2013, 04:04 PM   #4
BroX
Member
 
Registered: Oct 2003
Location: Sweden
Distribution: Slackware64-current, SlackwareARM-15.0
Posts: 835

Rep: Reputation: 90
Syntax should be
Code:
export PATH=$PATH:/home/bin
and you can add it to ~/.bashrc

If that file does not exist yet, you should create it, and add the following to it:
Code:
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

export PATH=$PATH:/home/bin
 
Old 10-26-2013, 04:06 PM   #5
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
You can put it in ~/.bashrc

Remember two things:
1. There are no spaces in bash variable assignments.
2. When you refer to a previously assigned variable you need to put the dollar sign in front of it
3. I think you've forgotten to specify which user's home directory you are referring to.
So:

Code:
export PATH:$PATH:/home/user/bin
edit: too late

Last edited by sycamorex; 10-26-2013 at 04:07 PM.
 
Old 10-26-2013, 05:09 PM   #6
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 288

Rep: Reputation: 155Reputation: 155
I like to make sure that I don't add the directory if it is already there:
Code:
if [ ! $(echo $PATH|grep $HOME/bin) ]; then
          export PATH=$HOME/bin:$PATH
fi
I also recommend placing your $HOME/bin directory first in the path, so you can override or change the defaults of system commands.

Last edited by saulgoode; 10-26-2013 at 05:10 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Add the xyz directory to your path (what path?) Eerie Linux - Newbie 3 06-06-2012 04:48 PM
Add path to $PATH variable alaios SUSE / openSUSE 2 04-19-2009 08:41 AM
Do you add to the path line or make a new path in /etc/profile? M$ISBS Linux - Newbie 2 12-13-2006 02:14 PM
Add path to @INC deus1 Linux - Software 0 07-27-2005 07:52 AM
How do I add something to my $PATH? iammeuno Linux - Software 1 12-18-2003 04:02 PM

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

All times are GMT -5. The time now is 06:05 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