【发布时间】:2019-08-06 10:29:00
【问题描述】:
我正在编写一个脚本,它使用以下命令创建要使用的目录mktemp -d
我必须在以上述方式创建的目录中添加一个 umask。我必须将它添加到代码的退出条件中。
下面是示例代码:
DIR1=$(mktemp -d)
wget_output=$(wget -q -P "$DIR1" "$CERT1")
if [ $? -ne 0 ]; then
echo "Certificates NOT Found OR Saving the certificates in directory failed."
exit
fi
怎么做?
【问题讨论】:
-
不清楚。 mktemp 不服从 umask 吗?或者你想为它设置一个特定的umask?还是别的什么?
-
是的,我想设置一个特定的值而不是系统默认值。
-
事后对它进行 chmod 还不够好?是的,这留下了一个小的漏洞窗口,但未能将其恢复的危险更大。