Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I tried changing it the way recommended in How do i change my default shell from bash to zsh?, as shown below:

chsh -s $(which zsh)

but that gave me an error. The system asks me to use ypchsh instead, but that gives me this error message:

ypchsh: can't get local yp domain: Local domain name not set

What can I do to set my remote shell to zsh?

share|improve this question
1  
That sounds as if the yellow page service (yp) is not properly configurated... a ugly workaround (also in case zsh is not listed in /etc/shells -- perhaps you can check this, too) is to include exec /bin/zsh in the .profile file (or whatever file will be read by the default shell). –  mpy Mar 3 '13 at 10:14
add comment

1 Answer 1

up vote 2 down vote accepted

You could contact the system administrator and ask if that is supposed to be supported, and if so for him/her to fix it.

What I do in a cluster where changing the shell to zsh is not supported is this (inside my ~/.bashrc):

# if this is an interactive shell
if [[ $- == *i* ]]; then
  # if on one of those annoying hosts...
  if [[ `uname -n` == PATTERN_MATCHING_SOME_HOSTNAMES ]]; then
     # if there is actually a zsh command available
     if [[ -x `which --skip-alias zsh 2>/dev/null` ]]; then
        # avoid spawning zsh every time bash is started...
        if [ -z $ZSH_STARTED ]; then
            export ZSH_STARTED="true"
            # if the call to zsh fails, scp a different conf there
            exec zsh
        fi
     fi
  fi
fi
share|improve this answer
2  
This is basically what I meant in my comment above. Two remarks: (i.) You can very often compile zsh in your home directory (few dependecies), so you don't have to use some (ancient) version which is installed by chance. (ii.) change zsh in your code to exec zsh and gone is the disadvantage that you need to log out twice! –  mpy Mar 4 '13 at 19:08
    
edited the answer including the exec... –  Francisco Mar 5 '13 at 17:24
    
I haven't 100% tested, but I think .bashrc is only sourced on interactive shells. The test for interactive shell won't hurt, but in theory it isn't needed. (ksh needs the test though, which I've found out the hard way) –  Rich Homolka Mar 5 '13 at 17:41
1  
IIRC many Linux distro's will source .bashrc from .profile thus it may get executed also for non-interactive shells. –  Francisco Mar 5 '13 at 20:36
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.