Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
help with termianal
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="cptkrf" data-source="post: 1000951" data-attributes="member: 134861"><p>Save the following script (and be sure to chmod it to 755). Run it and it will open a new tab(s) in the same folder.</p><p></p><p></p><p></p><p></p><p>#!/bin/sh</p><p></p><p># Make a new OS X Terminal tab with the current working directory.</p><p></p><p>if [ $# -ne 1 ]; then</p><p> PATHDIR=`pwd`</p><p>else</p><p> PATHDIR=$1</p><p>fi</p><p></p><p>/usr/bin/osascript <<EOF</p><p>activate application "Terminal"</p><p>tell application "System Events"</p><p> keystroke "t" using {command down}</p><p>end tell</p><p>tell application "Terminal"</p><p> repeat with win in windows</p><p> try</p><p> if get frontmost of win is true then</p><p> do script "cd $PATHDIR; clear" in (selected tab of win)</p><p> end if</p><p> end try</p><p> end repeat</p><p>end tell</p><p>EOF</p><p>clear</p></blockquote><p></p>
[QUOTE="cptkrf, post: 1000951, member: 134861"] Save the following script (and be sure to chmod it to 755). Run it and it will open a new tab(s) in the same folder. #!/bin/sh # Make a new OS X Terminal tab with the current working directory. if [ $# -ne 1 ]; then PATHDIR=`pwd` else PATHDIR=$1 fi /usr/bin/osascript <<EOF activate application "Terminal" tell application "System Events" keystroke "t" using {command down} end tell tell application "Terminal" repeat with win in windows try if get frontmost of win is true then do script "cd $PATHDIR; clear" in (selected tab of win) end if end try end repeat end tell EOF clear [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
help with termianal
Top