使用当前工作目录在OSX上打开多个新的终端选项卡

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用当前工作目录在OSX上打开多个新的终端选项卡相关的知识,希望对你有一定的参考价值。

  1. # Open a new tab on OSX Terminal with the current working dir.
  2. # Optionally, pass the number of tabs as parameter.
  3. #
  4. # Example:
  5. #
  6. # cd /my/very/long/path/and/i/dont/want/to/repeat/myself
  7. # nt 10
  8. #
  9. # You should add this to your ~/.profile
  10. #
  11. function nt {
  12. if [ $# -ne 1 ]; then
  13. TIMES=1
  14. else
  15. TIMES=$1
  16. fi
  17.  
  18. osascript -e "
  19. repeat $TIMES times
  20. tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
  21. tell application \"Terminal\" to do script \"cd $PWD; clear;\" in selected tab of the front window
  22. end repeat
  23. " > /dev/null 2>&1
  24. }

以上是关于使用当前工作目录在OSX上打开多个新的终端选项卡的主要内容,如果未能解决你的问题,请参考以下文章