如何从命令行或 bash 脚本启动 Dolphin 文件管理器(并为其指定路径)?

如何从命令行或 bash 脚本启动 Dolphin 文件管理器(并为其指定路径)?

我想从 bash 脚本打开 Dolphin 窗口。这可能与问题无关,但我将连接到 Dolphin 中的 SFTP 位置。

首先,我尝试从脚本中执行以下命令:

dolphin sftp://MyHost:1234

这会导致几个警告:

kdeinit4: Shutting down running client. klauncher: Exiting on signal
15 Connecting to deprecated signal
QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
QDBusConnection: session D-Bus connection created before
QCoreApplication. Application may misbehave. KDE Daemon (kded) already
running. QDBusConnection: session D-Bus connection created before
QCoreApplication. Application may misbehave. kbuildsycoca4 running...
kbuildsycoca4(13252) KConfigGroup::readXdgListEntry: List entry
MimeType in "/usr/NX/share/applnk/x-nxclient/nxclient.desktop" is not
compliant with XDG standard (missing trailing semicolon). 
kbuildsycoca4(13252) parseLayoutNode: The menu spec file contains a
Layout or DefaultLayout tag without the mandatory Merge tag inside.
Please fix your file.  kbuildsycoca4(13252) parseLayoutNode: The menu
spec file contains a Layout or DefaultLayout tag without the mandatory
Merge tag inside. Please fix your file.  dolphin(13244)
KXMLGUI::ActionList::plug: Index  19  is not within range (0 -  11 
kio_trash(13254) TrashProtocol::createUDSEntry: couldn't stat 
"/home/user/.local/share/Trash/files/.DS_Store"

接下来我尝试从脚本中执行以下命令:

dbus-launch dolphin sftp://MyHost:1234

这会导致更多警告:

kdeinit4: Shutting down running client. Connecting to deprecated
signal
QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
QDBusConnection: session D-Bus connection created before
QCoreApplication. Application may misbehave. QDBusConnection: session
D-Bus connection created before QCoreApplication. Application may
misbehave. kbuildsycoca4 running... QDBusObjectPath: invalid path ""
QObject::connect: Cannot connect (null)::deviceFound(Device*) to
BlueDevilDaemon::deviceFound(Device*) QObject::connect: Cannot connect
QTimer::timeout() to (null)::stopDiscovery() QDBusConnection: session
D-Bus connection created before QCoreApplication. Application may
misbehave. QDBusConnection: session D-Bus connection created before
QCoreApplication. Application may misbehave. QDBusConnection: session
D-Bus connection created before QCoreApplication. Application may
misbehave. QDBusConnection: session D-Bus connection created before
QCoreApplication. Application may misbehave. QDBusConnection: session
D-Bus connection created before QCoreApplication. Application may
misbehave. No outputs have backlight property QDBusConnection: session
D-Bus connection created before QCoreApplication. Application may
misbehave. dolphin(13176) KXMLGUI::ActionList::plug: Index  19  is not
within range (0 -  11  QDBusConnection: name 'org.kde.kglobalaccel'
had owner '' but we thought it was ':1.5' Warning from helper: reading
brightness failed with error code  5 "No such file or directory" 
Warning from helper: reading brightness failed with error code  5 "No
such file or directory"  kded(13187)
PowerDevilUPowerBackend::brightness:
org.kde.powerdevil.backlighthelper.brightness failed  Warning from
helper: writing brightness failed with error code  5 "No such file or
directory"  Warning from helper: writing brightness failed with error
code  5 "No such file or directory"  kded(13187)
PowerDevilUPowerBackend::setBrightness:
org.kde.powerdevil.backlighthelper.setbrightness failed 
kio_trash(13205) TrashProtocol::createUDSEntry: couldn't stat 
"/home/user/.local/share/Trash/files/.DS_Store"

如何从 bash 脚本启动 Dolphin 文件管理器并为其提供 (SFTP) 路径?

答案1

这有帮助吗:

在 KDE 上的 Dolphin 和 Konqueror 中使用 ssh 浏览远程文件系统

然后将 stderr 重定向到文件或 /dev/null,如下所示:

dolphin sftp://<usr@host>/ 2> /dev/null

相关内容