从名称中带有空格的服务器挂载 SMB 共享

Jaw*_*wap 5 bash shell smb mount escaping

我正在尝试在终端上安装 SMB 共享。如果使用以下命令服务器的名称中没有空格,我可以做到这一点:

$ mount -t smbfs //user:password@server/resource /Volumes/resource
Run Code Online (Sandbox Code Playgroud)

但是,在我的情况下,服务器名称有一个空格,我无法弄清楚如何正确传递这样的名称。

我尝试使用双引号或单引号:

$ mount -t smbfs "//user:password@ser ver/resource" /Volumes/resource
mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument
Run Code Online (Sandbox Code Playgroud)

我尝试逃离空间:

$ mount -t smbfs //user:password@ser\ ver/resource /Volumes/resource
mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument
Run Code Online (Sandbox Code Playgroud)

我也尝试使用%20, \x20and \040,但出现错误:

mount_smbfs: server connection failed: No route to host
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用 IP 地址或重命名服务器,但这将是一种解决方法而不是解决方案,我想知道我错过了什么。

Bob*_*ous 1

如果将引号和转义结合起来会发生什么:

mount -t smbfs "//user:password@ser\ ver/resource" /Volumes/resource
Run Code Online (Sandbox Code Playgroud)

据报道,在安装用户名中有空格的 smbfs 卷时,这对某人有用。