{"id":740,"date":"2024-05-20T17:25:44","date_gmt":"2024-05-20T22:25:44","guid":{"rendered":"http:\/\/csic.som.emory.edu\/~lzhou\/blogs\/?p=740"},"modified":"2024-05-20T17:25:44","modified_gmt":"2024-05-20T22:25:44","slug":"stop-tcsh-log-in-script-from-interrupting-scp","status":"publish","type":"post","link":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/?p=740","title":{"rendered":"Stop tcsh log in script from interrupting scp"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you are using tcsh shell, and your login script has screen output like an echo line, scp will be interrupted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To prevent this, knowing that for an interactive ssh session, it will open a tty, but embedded session like scp will not generate a tty.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thus this can be distinguished by checking if the variable $SSH_TTY is defined.  For example, you can put this in your ~\/.cshrc<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">if ($?SSH_TTY) then<br>    (do your login environment settings here)<br>else<br>    set sh = \/bin\/bash<br>     set cmdline = &#8220;<code>tr '\\0\\n' '\\n\\1' &lt;\/proc\/$$\/cmdline<\/code>&#8220;<br>    if ($#cmdline &gt; 2) then<br>    exec $sh -c &#8216;exec &#8220;$0&#8221; -c &#8220;$(printf %s &#8220;$1&#8221; | tr &#8220;\\1&#8221; &#8220;\\n&#8221;)&#8221;&#8216; $sh $cmdline[3]:q<br>    endif<br>endif<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This, will launch a log in script free session for embedded sessions like scp.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are using tcsh shell, and your login script has screen output like an echo line, scp will be interrupted. To prevent this, knowing that for an interactive ssh session, it will open a tty, but embedded session like scp will not generate a tty. Thus this can be distinguished by checking if the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,3],"tags":[],"class_list":["post-740","post","type-post","status-publish","format-standard","hentry","category-computer-tips","category-mri-technical-support","post-blog"],"_links":{"self":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=740"}],"version-history":[{"count":1,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/740\/revisions"}],"predecessor-version":[{"id":741,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=\/wp\/v2\/posts\/740\/revisions\/741"}],"wp:attachment":[{"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csic.som.emory.edu\/~lzhou\/blogs\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}