{"id":288,"date":"1997-09-09T01:36:29","date_gmt":"1997-09-09T09:36:29","guid":{"rendered":"http:\/\/www.birdhouse.org\/betips\/?p=288"},"modified":"1997-09-09T01:36:29","modified_gmt":"1997-09-09T09:36:29","slug":"tracker-terminal-communication","status":"publish","type":"post","link":"https:\/\/www.betips.net\/?p=288","title":{"rendered":"Tracker &#8211; Terminal communication"},"content":{"rendered":"<p>If you want to be able to double-click shell scripts to have them executed graphically (e.g. with the assistance of alert boxes), you may discover that the Tracker doesn&#8217;t pass the current directory location to the Terminal, and that file copy operations (as might be used for an install routine) don&#8217;t work as expected.<br \/>\nThe solution is to use a variable like this in your script:<\/p>\n<pre>launchDir=$(dirname $0)<\/pre>\n<p>$0 is a special variable with the full pathname of the script. dirname is a command that takes a full path and chops out just the directory portion of it. Assign it to the launchDir variable, and you&#8217;ve got the directory the script is sitting in. Very convenient.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to be able to double-click shell scripts to have them executed graphically (e.g. with the assistance of alert boxes), you may discover that the Tracker doesn&#8217;t pass the current directory location to the Terminal, and that file copy operations (as might be used for an install routine) don&#8217;t work as expected. The [&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":[10],"class_list":["post-288","post","type-post","status-publish","format-standard","hentry","tag-scripting"],"_links":{"self":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/288","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=288"}],"version-history":[{"count":0,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/288\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}