Last active
June 1, 2018 07:11
-
-
Save drewthorp/d765858d20e3c6c5ee72 to your computer and use it in GitHub Desktop.
Fish shell function to open a new tab in OS X terminal and run a series of commands. Usage tab cmd1 cmd2....
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
function tab | |
set -l ascmd "osascript -e 'tell application \"Terminal\" to activate' -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down'" | |
for arg in $argv | |
set ascmd "$ascmd -e 'tell application \"Terminal\" to do script \"$arg\" in selected tab of the front window'" | |
end | |
set -l ascmd "$ascmd;" | |
eval $ascmd | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment