-
-
Save ilstar/1100837 to your computer and use it in GitHub Desktop.
batch open iTerm tab with same path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
# | |
# Install | |
# copy this file to a directory which is one of your system PATH | |
# chmod +x filename | |
# | |
# Usage | |
# rcd ~/Download 3 | |
# argv 1: the path which you want to "cd" | |
# argv 2: the count of new tab. | |
# | |
# NOTE: this script only works for iTerm. | |
on run argv | |
tell application "iTerm" | |
set mypath to ("cd " & item 1 of argv) | |
set tab_count to (item 2 of argv as integer) | |
tell the first terminal | |
tell the last session | |
write text mypath | |
end tell | |
repeat with a from 1 to tab_count | |
launch session "Default Session" | |
tell the last session | |
write text mypath | |
end tell | |
end repeat | |
end tell | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment