LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Path is not getting set correctly (https://www.linuxquestions.org/questions/linux-newbie-8/path-is-not-getting-set-correctly-4175501589/)

kwatts59 04-13-2014 06:55 PM

Path is not getting set correctly
 
Hi all,
I am having problems with setting my PATH environment variable.
I am trying to include the path to my cufflinks-2.2.0 program so I can run the latest version of my cufflinks software.

Here is my .bashrc file

Code:

# .bashrc

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

export PATH=$PATH:/usr/local/bioinfo/cufflinks-2.2.0.Linux_x86_64

However, when I try running my cufflinks program, it always runs the old version 2.1.1. When I type "echo $PATH" I get the following output (line feeds were added for clarity) :
Code:

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:
/usr/local/bioinfo/blast_2.2.28+/bin:
/sbin/:/usr/sbin:/usr/local/bioinfo/bowtie2-2.1.0:
/usr/local/bioinfo/tophat-2.0.9.Linux_x86_64:
/usr/local/bioinfo/samtools-0.1.9:
/usr/local/bioinfo/cufflinks-2.1.1.Linux_x86_64:
/home/kwatanabe/bin/i686:/usr/local/bioinfo/ncbi-blast-2.2.25+/bin:
/usr/local/bioinfo/bioprospector:
/home/kwatanabe/bin:/usr/local/bioinfo/blast_2.2.28+/bin:
/usr/local/bioinfo/cufflinks-2.2.0.Linux_x86_64


Notice that there are 2 entries for a cufflinks directory.
Where does this cufflinks-2.1.1 directory get added to PATH?



Below is the /etc/bashrc file verbatum

Code:

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# It's NOT good idea to change this file unless you know what you
# are doing. Much better way is to create custom.sh shell script in
# /etc/profile.d/ to make custom changes to environment. This will
# prevent need for merging in future updates.

# By default, we want this to get set.
# Even for non-interactive, non-login shells.
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 002
else
    umask 022
fi

# are we an interactive shell?
if [ "$PS1" ]; then
    case $TERM in
    xterm*)
        if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
            PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
        else
            PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
        fi
        ;;
    screen)
        if [ -e /etc/sysconfig/bash-prompt-screen ]; then
            PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
        else
            PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
        fi
        ;;
    *)
        [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
        ;;
    esac
    # Turn on checkwinsize
    shopt -s checkwinsize
    [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
    # You might want to have e.g. tty in prompt (e.g. more virtual machines)
    # and console windows
    # If you want to do so, just add e.g.
    # if [ "$PS1" ]; then
    #  PS1="[\u@\h:\l \W]\\$ "
    # fi
    # to your custom modification shell script in /etc/profile.d/ directory
fi

if ! shopt -q login_shell ; then # We're not a login shell
    # Need to redefine pathmunge, it get's undefined at the end of /etc/profile
    pathmunge () {
        case ":${PATH}:" in
            *:"$1":*)
                ;;
            *)
                if [ "$2" = "after" ] ; then
                    PATH=$PATH:$1
                else
                    PATH=$1:$PATH
                fi
        esac
    }

    # Only display echos from profile.d scripts if we are no login shell
    # and interactive - otherwise just process them to set envvars
    for i in /etc/profile.d/*.sh; do
        if [ -r "$i" ]; then
            if [ "$PS1" ]; then
                . $i
            else
                . $i >/dev/null 2>&1
            fi
        fi
    done

    unset i
    unset pathmunge
fi
# vim:ts=4:sw=4

#for blast-2.2.28
export PATH=$PATH:/usr/local/bioinfo/blast_2.2.28+/bin

Any help would be appreciated.
Thanks in advance.

suicidaleggroll 04-13-2014 07:24 PM

Did you check your .bash_profile file?

You could also put your entry before the rest of the entries in PATH instead of after:
Code:

export PATH=/usr/local/bioinfo/cufflinks-2.2.0.Linux_x86_64:$PATH

kwatts59 04-14-2014 12:24 PM

Here is my .bash_profile. I don't see anything suspicious.

Code:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

I fixed the problem by putting the following line as the first line of my .bashrc file

Code:

export PATH='/usr/local/sbin:/usr/local/bin:/bin:/usr/bin'
This clears the PATH variable of any prior definitions.
I don't know if this is the best way to fix the problem but it works.
Thanks all for your help.


All times are GMT -5. The time now is 10:39 AM.