{"id":121,"date":"2009-01-12T03:07:00","date_gmt":"2009-01-12T03:07:00","guid":{"rendered":"http:\/\/10.168.29.5\/blog\/?p=121"},"modified":"2010-02-15T04:55:55","modified_gmt":"2010-02-15T04:55:55","slug":"fixed-remote-ssh-command-failing","status":"publish","type":"post","link":"https:\/\/davidsterry.com\/blog\/2009\/01\/fixed-remote-ssh-command-failing\/","title":{"rendered":"Fixed: Remote SSH Command Failing"},"content":{"rendered":"<p>One great way to use SSH is to run a single command on a remote server like this:<\/p>\n<blockquote><p>ssh user@host command<\/p><\/blockquote>\n<p>&#8216;command&#8217; here can be anything and the text output will be piped back to your local terminal.<\/p>\n<p>I was having a problem with a few servers where this wasn&#8217;t working. Turns out the problem was this line in my user&#8217;s .bashrc<\/p>\n<blockquote><p>[ -z &#8220;$PS1&#8221; ] &#038;&#038; exit 0<\/p><\/blockquote>\n<p>In this case, the -z tests &#8220;$PS1&#8221; (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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One great way to use SSH is to run a single command on a remote server like this: ssh user@host command &#8216;command&#8217; 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&#8217;t working. Turns out the problem [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[16,15],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-default","tag-bash","tag-ssh"],"_links":{"self":[{"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/comments?post=121"}],"version-history":[{"count":1,"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":148,"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/posts\/121\/revisions\/148"}],"wp:attachment":[{"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/media?parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/categories?post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davidsterry.com\/blog\/wp-json\/wp\/v2\/tags?post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}