在 Mac OS X 终端中启动 Finder 并突出显示从终端中选择的特定文件?

Xia*_*iao 2 finder terminal bash macos

我有一个在/tmp目录中创建几个文件的脚本

#!/bin/bash
touch /tmp/file1.txt
touch /tmp/file2.txt
Run Code Online (Sandbox Code Playgroud)

如何让脚本/tmp/在 Finder 中打开带有两个文件的目录file1.txtfile2.txt选中?

我知道我可以打开文件夹:

open /tmp/
Run Code Online (Sandbox Code Playgroud)

但它(显然)没有选择这两个文件。

Chr*_*age 5

查看 open(1) 命令的手册页:x-man-page://1/open

在那里你会找到-R选项:

-R  Reveals the file(s) in the Finder instead of opening them.
Run Code Online (Sandbox Code Playgroud)