mac osx在终端打开应用程序

找了一下 发现 open 命令可以实现:

如下看 open命令的 说明:

 

[plain]  view plain  copy
  1. open: unrecognized option `--help'  
  2. Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]  
  3. Help: Open opens files from a shell.  
  4.       By default, opens each file using the default application for that file.    
  5.       If the file is in the form of a URL, the file will be opened as a URL.  
  6. Options:   
  7.       -a                Opens with the specified application.  
  8.       -b                Opens with the specified application bundle identifier.  
  9.       -e                Opens with TextEdit.  
  10.       -t                Opens with default text editor.  
  11.       -f                Reads input from standard input and opens with TextEdit.  
  12.       -F  --fresh       Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.  
  13.       -R, --reveal      Selects in the Finder instead of opening.  
  14.       -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).  
  15.           --args        All remaining arguments are passed in argv to the application's main() function instead of opened.  
  16.       -n, --new         Open a new instance of the application even if one is already running.  
  17.       -j, --hide        Launches the app hidden.  
  18.       -g, --background  Does not bring the application to the foreground.  
  19.       -h, --header      Searches header file locations for headers matching the given filenames, and opens them.  


可以用

 

 

 open  -a    AppName   filename  Args 的方式打开。

比如我要打开一个, Graphviz.app   并用它打开文件  aa.dot :

 open -a  Graphviz  aa.dot 

猜你喜欢

转载自youyanweixiao.iteye.com/blog/2280126
今日推荐