Re: How is the default value of PATH environment variable being set in Fedora?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/17/14 16:38, Piotr Dobrogost wrote:
> Hi!
>
> When I login using terminal (for instance after pressing CTRL+ALT+F2)
> the `PATH ` environment variable looks like this:
>
> `/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin/:/usr/sbin:/home/user/.local/bin:/home/user/bin`
>
> However when I open new Konsole window it looks like this:
>
> `/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin`
>
> Notice, that in the first case `/usr/local/bin` precedes
> `/bin:/usr/bin` whereas in the second case it's the other way around.
>
> What mechanism governs this and how can I configure it so that in the
> second case `/usr/local/bin` precedes `/usr/bin`?
>
> I took a look in `/etc/profile` but there I see only `/usr/local/sbin`
> and `/usr/sbin` being set:
>
>     # Path manipulation
>     if [ "$EUID" = "0" ]; then
>         pathmunge /usr/sbin
>         pathmunge /usr/local/sbin
>     else
>         pathmunge /usr/local/sbin after
>         pathmunge /usr/sbin after
>     fi
>
> In the `/etc/environment` I have nothing that sets or changes `PATH`.
>
> I know I can overwrite `PATH` in one of bash rc scripts but I would
> like to know how this default `PATH` is being set in the first place.
>
>
> I'm on KDE spin of Fedora 21.
>
> Thank you in advance.

Look in your ~/.bashrc and, if you've not changed anything, you'll see....

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

And then look in /etc/bashrc and you'll see....

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
    }


So, it depends on if your shell is a login shell or not. 

Also, other bits in $PATH are set via scripts in /etc/profile.d/ .

-- 
If you can't laugh at yourself, others will gladly oblige.

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux