“open -a TextMate.app”和“open -a TextMate.app”有什么区别?和“伙伴”?
我认为 mate 实际上与“open -a TextMate.app”相同,但我想我错了。
当我运行以下命令时,当没有 hello2.txt 时,我收到此错误。
open -a TextMate.app hello2.txt The file /Users/smcho/hello2.txt does not exist.
不过,跑哥们儿还是可以的。
mate hello.txt --> opens the text mate.
两者有什么区别?
我什至尝试过
open -a TextMate.app --args hello2.txt
,但这一次,TextMate 使用文件名“Untitled”运行,而不是“hello2.txt”。
这段代码打开“hello3.txt”没有任何问题。
[NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app/Contents/MacOS/TextMate" arguments:[NSArray arrayWithObjects:@"hello3.txt", nil]];
I've thought that mate is virtually the same as 'open -a TextMate.app', but I guess I'm wrong in this.
As when I run the following command, when there's no hello2.txt, I get this error.
open -a TextMate.app hello2.txt The file /Users/smcho/hello2.txt does not exist.
But, it's OK to run mate.
mate hello.txt --> opens the text mate.
What's the difference between the two?
I even tried
open -a TextMate.app --args hello2.txt
But this time, TextMate run with the file name 'Untitled', not 'hello2.txt'.
And this code opens the 'hello3.txt' without any problem.
[NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app/Contents/MacOS/TextMate" arguments:[NSArray arrayWithObjects:@"hello3.txt", nil]];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
open
将使用默认或特定应用程序打开给定文件。表示“使用应用程序 TextMate.app 打开文件
hello2.txt
”。如果没有
hello2.txt
,则无论有或没有 TextMate.app,都无法打开任何open
内容,因此会出现错误。意味着“在应用程序 TextMate.app 中不打开任何特定内容(即仅打开 TextMate.app)并传递 'hello2.txt' 作为附加参数”。这是与第一个例子不同的论证。 TextMate.app 可以决定如何处理该附加参数。显然它选择忽略它。
mate
是 TextMate 可选安装的实用程序。意思是“我想在 TextMate 中编辑一个名为
hello.txt
的文件”,这正是 TextMate 让您做的事情。它是一个不同的实用程序,具有不同的行为和不同的目的,并且它似乎更适合您想要它做的事情。open
will open the given file with the default or a specific application.means "Open the file
hello2.txt
using the application TextMate.app".If there is no
hello2.txt
, there's nothingopen
could open, with or without TextMate.app, hence the error.means "open nothing specific in the application TextMate.app (i.e. only open TextMate.app) and pass 'hello2.txt' as additional argument". This is a different kind of argument than the first example. TextMate.app can decide what to do with that additional argument. Apparently it chooses to ignore it.
mate
is a utility optionally installed by TextMate.means "I'd like to edit a file called
hello.txt
in TextMate", which is exactly what TextMate will let you do. It's a different utility with different behavior and different purpose, and it seems to better suite what you want it to do.