Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have two PuTTy sessions open to the same host. One one cd ~ gets me back to my home dir fine and on another one it doesn't -- stays in the same dir.

I have never seen something like this happen.

Any idea why this might be happening?

OS: SunOS 5.10

share|improve this question
    
what shell are you using? Also, dump both environments, ie set > env_goodwindow ; set > env_badwindow` and diff them. Same for stty settings. Good luck. –  shellter Oct 5 '12 at 19:15
    
BTW, cd alone takes you to your home directory. No need for the ~ –  Stéphane Chazelas Oct 5 '12 at 20:24
1  
cd alone doesn't work either ... :( –  amphibient Oct 5 '12 at 20:51
    
Does this always happen each time you open two ssh connections to the host, or did it happen just once? –  user13764 Oct 6 '12 at 1:38
add comment

1 Answer 1

It sounds like you've changed or unset your $HOME environment variable in one of the ssh sessions.

$HOME is the default arg for the cd built-in, at least for all the sh-like shells that I have installed on my system (incl. dash, bash, ksh, and zsh).

They all have something like this in their man page (from dash):

 HOME   The home directory of the current user; the default argument for
        the cd builtin command.  The value of this variable is also used
        when performing tilde expansion.
share|improve this answer
    
csh and tcsh use $home (lowercase). –  cas Oct 6 '12 at 3:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.