David Sterry's Blog


Sunday, January 11, 2009

Fixed: Remote SSH Command Failing

One great way to use SSH is to run a single command on a remote server like this:
ssh user@host command

'command' here can be anything and the text output will be piped back to your local terminal.

I was having a problem with a few servers where this wasn't working. Turns out the problem was this line in my user's .bashrc
[ -z "$PS1" ] && exit 0

In this case, the -z tests "$PS1" (the prompt string) for null. Since the prompt was null, .bashrc exited on me. After removing that line, all was fine. If you know a better way to work around this or some very important reason the -z line should stay, feel free to leave a comment.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home