LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Easy question: How to add/modify the path? (https://www.linuxquestions.org/questions/slackware-14/easy-question-how-to-add-modify-the-path-4175424674/)

wolf2600 08-29-2012 09:06 PM

Easy question: How to add/modify the path?
 
You know, when you do 'which something', and get 'no something in yadda, yadda, yadda'.

How do I add additional directories to be searched in that yadda?

Slack 13.1.

Thanks.

wolf2600 08-29-2012 09:12 PM

Tried the answer I found in Google:

PATH=$PATH:/usr/local/rvm/bin

But that didn't seem to do it.

abrinister 08-29-2012 09:21 PM

On the command line you need to do:

Code:

export PATH=$PATH:<whatever>
If you don't want to do this every time, I suggest you add that command to your .bashrc.

Alex Brinister

wolf2600 08-29-2012 09:25 PM

Quote:

Originally Posted by abrinister (Post 4767890)
On the command line you need to do:

Code:

export PATH=$PATH:<whatever>
If you don't want to do this every time, I suggest you add that command to your .bashrc.

Alex Brinister

Don't hate me..... where might I find .bashrc? :o

abrinister 08-29-2012 09:27 PM

There is one in your home dir and in /etc/bash.bashrc. I would recommend only editing your own unless you want it system-wide.

Alex Brinister

wolf2600 08-29-2012 09:31 PM

If I'm logged in as root, should I have a .bashrc in my ~?

And if one isn't there (I did an 'ls -a', and the only bash thing is .bash-history).

Am I missing something, or can I just create the .bashrc file with just the export line?

T3slider 08-29-2012 09:36 PM

You can just create the file. It does not exist by default in Slackware but it will work if available. I may be mistaken but I don't think /etc/bashrc (or /etc/bash.bashrc) will work system-wide, since that is not a bash feature (most distros ship a .bashrc in /etc/skel that references /etc/bashrc that gets copied to a new user's home directory).

abrinister 08-29-2012 09:38 PM

Really? I'm running Arch:

Code:

[fluffypony@0xffeDAEMONPAWNY1969 ~]$ ls /etc/ | grep bash
bash.bash_logout
bash.bashrc

Code:

[fluffypony@0xffeDAEMONPAWNY1969 ~]$ cat /etc/bash.bashrc   
#
# /etc/bash.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

PS1='[\u@\h \W]\$ '
PS2='> '
PS3='> '
PS4='+ '

case ${TERM} in
  xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
                                                       
    ;;
  screen)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
    ;;
esac

[ -r /usr/share/bash-completion/bash_completion  ] && . /usr/share/bash-completion/bash_completion

Code:

[fluffypony@0xffeDAEMONPAWNY1969 ~]$ cat ./.bashrc
# .bashrc

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

# User specific aliases and functions

export TZ='EST+4'
#xscreensaver &

export PERL_LOCAL_LIB_ROOT="/home/fluffypony/perl5";
export PERL_MB_OPT="--install_base /home/fluffypony/perl5";
export PERL_MM_OPT="INSTALL_BASE=/home/fluffypony/perl5";
export PERL5LIB="/home/fluffypony/perl5/lib/perl5/x86_64-linux-thread-multi:/home/fluffypony/perl5/lib/perl5";
export PATH="/home/fluffypony/perl5/bin:$PATH";

export PERL_LOCAL_LIB_ROOT="/home/fluffypony/perl5";
export PERL_MB_OPT="--install_base /home/fluffypony/perl5";
export PERL_MM_OPT="INSTALL_BASE=/home/fluffypony/perl5";
export PERL5LIB="/home/fluffypony/perl5/lib/perl5/x86_64-linux-thread-multi:/home/fluffypony/perl5/lib/perl5";
export PATH="/home/fluffypony/perl5/bin:$PATH";

Maybe Arch is special...

Alex Brinister

NeoMetal 08-29-2012 09:55 PM

^ He's not saying the file isn't there, but that isn't typically run for every bash instance on the system, but used as a template for new user accounts initial bashrc if there is one.

Or that was what I understood from it

edit: nvm, didn't read the above closely enough

wolf2600 08-29-2012 09:56 PM

http://forums.offtopic.com/images/smilies/wavey.gif

Thanks!



edit: aww c'mon, what kind of a board doesn't allow img code???

T3slider 08-29-2012 10:28 PM

Quote:

Originally Posted by abrinister (Post 4767906)
Really? I'm running Arch:
...
Maybe Arch is special...

https://wiki.archlinux.org/index.php..._file_overview

It is non-standard. Arch adds a (non-standard) system bashrc at compile-time:
Code:

  _bashconfig=(-DDEFAULT_PATH_VALUE=\'\"/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin\"\'
              -DSTANDARD_UTILS_PATH=\'\"/usr/bin:/bin:/usr/sbin:/sbin\"\'
              -DSYS_BASHRC=\'\"/etc/bash.bashrc\"\'
              -DSYS_BASH_LOGOUT=\'\"/etc/bash.bash_logout\"\')

Slackware leaves it as the default value (which does not specify a system bashrc).

abrinister 08-29-2012 10:28 PM

I see. Thanks!

Getting back on topic, reading this page I realize the difference between bashrc and bash_profile. I would try both to see what suits you.

Alex Brinister

Didier Spaier 08-29-2012 10:49 PM

Quote:

Originally Posted by wolf2600 (Post 4767909)
edit: aww c'mon, what kind of a board doesn't allow img code???

This one does. Just click "Go Advanced" instead of "Post Quick Reply". You will be able to add one emoticon globally and others in the message body. :)


All times are GMT -5. The time now is 04:34 PM.