在 MacOS 上获取应用的捆绑标识符(Bundle identifier)
在 MacOS 上,使用<code>osascript</code>命令行工具可执行AppleScript和其他OSA语言脚本。通过<code>-e</code>选项,可以直接在命令行中输入执行脚本代码,例如获取应用程序的bundle identifier。Bundle identifier是唯一字符串,标识应用程序,一般格式为<code>com.companyname.appname</code>。命令<code>osascript -e 'id of app "Obsidian"' </code>可返回运行中应用程序"Obsidian"的bundle identifier。如果应用程序未安装或未运行,可能返回找不到应用程序的错误信息。