ssh . .profile doesn't find file - what is $PATH! - SSH

This is a discussion on ssh . .profile doesn't find file - what is $PATH! - SSH ; If I do: rsh B ". .profile" - OK If I do: ssh B ". .profile" - doesn't find .profile unless i do "./.profile" If I do: ssh B "echo $PATH" it shows . in the path - why can't ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: ssh . .profile doesn't find file - what is $PATH!

  1. ssh . .profile doesn't find file - what is $PATH!

    If I do: rsh B ". .profile" - OK
    If I do: ssh B ". .profile" - doesn't find .profile unless i do
    "./.profile"
    If I do: ssh B "echo $PATH" it shows . in the path -

    why can't it find .profile?

    (.profile is just an example)

    TIA
    Mark


  2. Re: ssh . .profile doesn't find file - what is $PATH!


    "Mister B" wrote in message
    news:1138819255.566977.301080@f14g2000cwb.googlegr oups.com...
    > If I do: rsh B ". .profile" - OK
    > If I do: ssh B ". .profile" - doesn't find .profile unless i do
    > "./.profile"
    > If I do: ssh B "echo $PATH" it shows . in the path -
    >
    > why can't it find .profile?
    >
    > (.profile is just an example)


    PATH has nothing to do with this action of "." "." means "source this file".

    I wonder what happens of you do "rsh B /bin/pwd" or "ssh B /bin/pwd", and if
    you have a broken .bashrc or .cshrc or other shell configuration files doing
    oddness on the target server?



  3. Re: ssh . .profile doesn't find file - what is $PATH!


    Nico Kadel-Garcia wrote:
    > "Mister B" wrote in message
    > > If I do: ssh B ". .profile" - doesn't find .profile unless i do
    > > "./.profile"
    > > If I do: ssh B "echo $PATH" it shows . in the path -


    > PATH has nothing to do with this action of "." "." means "source this file".


    Yes, but it has to know where to find "this file".
    Try this:

    PATH=/usr/bin
    export PATH
    cat > newfile
    pwd
    (or whatever your EOF character is)
    chmod +x newfile
    .. newfile (should get error message)
    PATH=$PATH:.
    .. newfile (should find newfile and print current
    directory)

    > I wonder what happens of you do "rsh B /bin/pwd" or "ssh B /bin/pwd"


    Not sure why this is relevant, but both commands work & I get current
    directory

    Mark
    mark . bergman @ thales - is . com


  4. Re: ssh . .profile doesn't find file - what is $PATH!

    Mister B wrote:
    > Nico Kadel-Garcia wrote:
    >> "Mister B" wrote in message
    >>> If I do: ssh B ". .profile" - doesn't find .profile unless i do
    >>> "./.profile"
    >>> If I do: ssh B "echo $PATH" it shows . in the path -

    >
    >> PATH has nothing to do with this action of "." "." means "source
    >> this file".

    >
    > Yes, but it has to know where to find "this file".
    > Try this:


    Well, yes. But that's a function of the shell itself, not of the PATH. PATH
    affects where the *first* argument in a command line can be found, namely
    the "." function tself.

    > PATH=/usr/bin
    > export PATH
    > cat > newfile
    > pwd
    > (or whatever your EOF character is)
    > chmod +x newfile


    chmod +x is irrelevant. newfile is not executed, it's sourced, which means
    reading it and executing its current contents with the active shell. That's
    why PATH is not relevant to this problem, I think.

    > . newfile (should get error message)
    > PATH=$PATH:.
    > . newfile (should find newfile and print current
    > directory)
    >
    >> I wonder what happens of you do "rsh B /bin/pwd" or "ssh B /bin/pwd"

    >
    > Not sure why this is relevant, but both commands work & I get current
    > directory


    I was guessing on this one. I'm wondering if you have some weirdness in your
    ..bashrc or .profile that is messing with your SSH based rsh commands. There
    are subtle differences between rsh and ssh in their handling of .login and
    ..bashrc.



+ Reply to Thread