{"id":352,"date":"1997-09-09T01:36:29","date_gmt":"1997-09-09T09:36:29","guid":{"rendered":"http:\/\/www.birdhouse.org\/betips\/?p=352"},"modified":"1997-09-09T01:36:29","modified_gmt":"1997-09-09T09:36:29","slug":"keep-terminal-windows-from-closing-automatically","status":"publish","type":"post","link":"https:\/\/www.betips.net\/?p=352","title":{"rendered":"Keep Terminal windows from closing automatically"},"content":{"rendered":"<p>This tip is based on the tip <a href=\"\/chunga.php?ID=076\">Title your Terminal<\/a>.<br \/>\nWhen you launch a console application in a Terminal window, the window will generally be closed after execution, which means you can&#8217;t read the results (note that this is not true when you simply type the name of a command into a Terminal window, but when you launch a new Terminal and a command all at once). To get around the situation, try this:<br \/>\n1) Launch the terminal with the -t flag, passing it a title and a script file. For example:<\/p>\n<pre>Terminal -t \"Compiling...\" \/bin\/sh -c \/boot\/home\/scriptfile<\/pre>\n<p>2) Include in the scriptfile the following commands (for example):<\/p>\n<pre>\n\t# call the GNU C++ compiler\n\tgcc\n\t# send a message to User after execution\n\tprintf \"return to continue\n\"\n\t#read the keystroke and close the Terminal application\n\tread -e response\n<\/pre>\n<p>The final <code>read<\/code> command will cause the window to stay open until you press a key. This lets you launch the GNU C++ compiler in a new Terminal window and read the compiler output without closing the Terminal window automatically.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tip is based on the tip Title your Terminal. When you launch a console application in a Terminal window, the window will generally be closed after execution, which means you can&#8217;t read the results (note that this is not true when you simply type the name of a command into a Terminal window, but [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[11],"class_list":["post-352","post","type-post","status-publish","format-standard","hentry","tag-terminal"],"_links":{"self":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=352"}],"version-history":[{"count":0,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/352\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}