Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: conflict of "exec zsh" with scp



Andy Spiegl wrote:
At work all my colleagues prefer bash (I couldn't convince them yet *sigh*).
But I can't live without zsh anymore.  So I put the following into .bashrc:

 if [[ "$REALUSER" == "Andy Spiegl" ]]; then
   which zsh >/dev/null 2>&1 && exec zsh -l
 fi

(the environment variable is coming from .ssh/authorized_keys)

This works great but now scp doesn't work anymore:
 lama:~>scp foo otherhost:
 stty: standard input: Invalid argument
 [1]    19108 exit 1     scp -C foo otherhost:

Any idea how to distinguish my ssh-connects from scp-connects in .bashrc?

Why don't you just chsh (man chsh) on your host instead of
doing .bashrc trickery? You all share the same shell account
on a single host?

You could also try to test the bash interactivity flag, and only
run zsh of it's set. Have not tried it myself, but here's a
snippet from the bash manual:

       An interactive shell is  one  started  without  non-option
       arguments  and  without the -c option whose standard input
       and output are both connected to terminals (as  determined
       by  isatty(3)), or one started with the -i option.  PS1 is
       set and $- includes i if bash is interactive,  allowing  a
       shell script or a startup file to test this state.

Casper

Thanks a lot,
 Andy.




Messages sorted by: Reverse Date, Date, Thread, Author