![在 smbclient mkdir 中使用空格](https://linux22.com/image/151490/%E5%9C%A8%20smbclient%20mkdir%20%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%A9%BA%E6%A0%BC.png)
我正在尝试在 bash 脚本中使用 smbclient 在远程 Windows 服务器上创建一个目录。
虽然这有效:
smbclient -U "DOMAIN/$username" "//remoteserver/folder with spaces" --directory "Another folder with spaces/" -c "mkdir /newfolder/"
这不会:
smbclient -U "DOMAIN/$username" "//remoteserver/folder with spaces" --directory "Another folder with spaces/" -c "mkdir /folder to create with spaces/"
相反,会创建一个简单地称为“文件夹”的文件夹。我尝试过很多变体,如下所示:
"mkdir /folder\ to\ create\ with\ spaces/"
"mkdir '/folder to create with spaces/'"
'mkdir '/folder to create with spaces/''
但似乎找不到神奇的组合。
答案1
这些选项应该有效:
-c 'mkdir "folder to create with spaces"'
-c "mkdir \"folder to create with spaces\""