【发布时间】:2022-01-15 09:31:39
【问题描述】:
我写了一个如下的 shellscript,来检查 samba 共享中的文件:
date_gen=$(date --date="3 days ago" +"%-Y%m%d")
fileName=${date_gen}"_Combined Reg Report.xlsx"
if [ ! -f smb://nfs/carboard/"${fileName}" -U ]
then
echo "File does not exist in Bash"
else
echo ${fileName}
fi
exit 1
有人可以帮我解决这个问题吗,我总是收到“文件在 Bash 中不存在”。文件夹中有文件。
谢谢, 艺术
【问题讨论】:
-
系统上是否挂载了共享?否则无法通过 shell 直接访问它,需要外部工具
-
好吧,我可以使用命令 smget 并将文件从共享文件夹复制到 unix 服务器。所以我认为共享已安装。这有帮助吗?
-
如果您使用的是
smbget,则表示该共享未挂载。