在大多数或所有linuxes上可用的“open”命令是什么?
例如,在OS X中,我可以在shell中进行操作
张开。
文件夹显示在Finder (即桌面)中,类似地,Windows上的命令是“explore”。
我问这个是因为我想在emacs中使用跨平台的命令。
(defun open-in-desktop ()
"Open the current file in desktop.
Works in Microsoft Windows and Mac OS X."
(interactive)
(cond
((string-equal system-type "windows-nt")
(w32-shell-execute "explore"
(replace-regexp-in-string "/" "\\" default-directory t t)))
((string-equal system-type "darwin") (shell-command "open ."))
) ) 有人建议使用xdg-open,但不确定它是否仅适用于发行版或gnome/kde。(我不是linux用户)
发布于 2010-11-04 01:23:53
xdg-utils来自freedesktop.org。freedesktop.org项目旨在提高Linux上各种不同桌面环境之间的互操作性。因此,这是在Linux上尽可能接近于实现这一点的可靠方法。
发布于 2010-11-04 01:22:18
xdg-open指向用户首选的浏览应用程序,因此通常可以正常工作。
https://stackoverflow.com/questions/4089696
复制相似问题