Guest User

Untitled

a guest
Feb 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. function tab() {
  2. local command="cd \"$PWD\"; clear; "
  3. (( $# > 0 )) && command="${command}; $*"
  4. }
  5.  
  6. local command="cd \"$PWD\""
  7. (( $# > 0 )) && command="${command}; $*"
  8.  
  9. the_app=$(
  10. osascript 2>/dev/null <<EOF
  11. tell application "System Events"
  12. name of first item of (every process whose frontmost is true)
  13. end tell
  14. EOF
  15. )
  16.  
  17. [[ "$the_app" == 'iTerm' ]] && {
  18. osascript 2>/dev/null <<EOF
  19. tell application "iTerm"
  20. set current_terminal to current terminal
  21. tell current_terminal
  22. launch session "Default Session"
  23. set current_session to current session
  24. tell current_session
  25. write text "${command}"
  26. end tell
  27. end tell
  28. end tell
  29. EOF
  30. }
Add Comment
Please, Sign In to add comment