在 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,如果应用程序已安装并正在运行则会返回对应的标识符,否则可能会返回错误信息。