在 Mac 上使用 Bash 使用默认浏览器打开 .html 文件 [英] Open an .html file with default browser using Bash on Mac

查看:41
本文介绍了在 Mac 上使用 Bash 使用默认浏览器打开 .html 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,这就是我需要的:

So, this is what I need :

假设我有一个 index.html 文件.

Let's say I have an index.html file.

如何告诉终端使用默认浏览器打开它?

How do I tell the terminal to open it using the default browser?

(使用 AppleScript、BASH、...?)

(Using AppleScript, BASH,...?)

推荐答案

从包含 index.html 的目录中,尝试...

from the directory containing index.html, try...

open ./index.html

open 命令打开一个文件(或目录或 URL).MacOSx 中包含 open.可以使用

the open command opens a file (or directory, or URL). open is included with MacOSx. specifics and options can be found using

man open

注意:默认应用程序是通过 LaunchServices 确定的.

note: default application is determined via LaunchServices.

这篇关于在 Mac 上使用 Bash 使用默认浏览器打开 .html 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆