find /Applications/Xcode.app -name swift -a -type f
以上命令中的-a選項表示的是and邏輯,妳也可以寫全稱為-and.所以妳必須同時符合name為swift,同時type為壹般文件這兩個條件才可以哦.
其他type的參數有:
-type t
True if the file is of the specified type. Possible file types are as follows:
b block special
c character special
d directory
f regular file
l symbolic link
p FIFO
s socket
在本貓的air上運行以上指令結果如下:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/bin/swift
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
第壹個swift版本顯然是2.3,我們看壹下後面Swift的版本:
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -version
Apple Swift version 3.0 (swiftlang-800.0.34.6 clang-800.0.33)
Target: x86_64-apple-macosx10.9
不出意外是Swift 3.0哦,我的Xcode是8.0beta4