PATH variable for a non-interactive session - SGI

This is a discussion on PATH variable for a non-interactive session - SGI ; Howdy, I sent this out last week and checked this morning and didn't see the article or any replies. So, I'm gonna send it again. I apologize if you've read it before... --- Me and a guy that I work ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: PATH variable for a non-interactive session

  1. PATH variable for a non-interactive session

    Howdy,

    I sent this out last week and checked this morning and didn't see the
    article or any replies. So, I'm gonna send it again. I apologize if
    you've read it before...

    ---

    Me and a guy that I work with were working on a problem the other day
    and the question came up as to where the PATH variable is set for a
    non-interactive session. What I mean by a non-interactive session is
    when you run a command on another machine via ssh using the syntax of

    ssh loginname@hostname "command that you wanna run"

    When I echo the $PATH in both cases, they are different.

    Any ideas?

    TIA,

    Pete

  2. Re: PATH variable for a non-interactive session

    On 2004-01-20, Peter R. Thorsen Jr. wrote:
    > Howdy,
    >
    > I sent this out last week and checked this morning and didn't see the
    > article or any replies. So, I'm gonna send it again. I apologize if
    > you've read it before...
    >
    > ---
    >
    > Me and a guy that I work with were working on a problem the other day
    > and the question came up as to where the PATH variable is set for a
    > non-interactive session. What I mean by a non-interactive session is
    > when you run a command on another machine via ssh using the syntax of
    >
    > ssh loginname@hostname "command that you wanna run"
    >
    > When I echo the $PATH in both cases, they are different.
    >
    > Any ideas?

    Yup, depending on which shell you're using the environment can be set
    based on several different files. Some of those files might not be used
    when you're in a non-interactive session.
    Since I use bash, I'll use that as example. It has basically two
    "config" files *bashrc[1] and *profile[2]. The rc file is normally run
    for non-interactive shells, while the profile does the setup for
    interactive shells.
    For csh style shells I believe the files are .(t)csh and .login - you'll
    also have to check to see what the different files actually does. Do
    they set the PATH variable only if you have and interactive terminal or
    not?

    Oh, and as a final note, ssh is usually compiled to provide some sort of
    default PATH as well.

    [1] /etc/profile, /etc/bash_profile, ~/.profile or ~/.bash_profile
    (Whoever said it was supposed to be simple
    [2] /etc/bash.bashrc or ~/.bashrc

    HTH
    --
    Ole-Morten Duesund

+ Reply to Thread