diff --git a/security-tool.sh b/security-tool.sh index c6bc4e7003aa0149c5db584202432f0a88c75a83..b6914dd4186904123b4d64ea308da3d0dd467078 100644 --- a/security-tool.sh +++ b/security-tool.sh @@ -643,8 +643,12 @@ function fn_handle_umask() if [ "$target" == "user" ] then - echo "umask $value" >> "$ROOTFS/etc/bashrc" - echo "umask $value" >> "$ROOTFS/etc/csh.cshrc" + if ! grep -q "^umask $value" $ROOTFS/etc/bashrc;then + echo "umask $value" >> "$ROOTFS/etc/bashrc" + fi + if ! grep -q "^umask $value" $ROOTFS/etc/csh.cshrc;then + echo "umask $value" >> "$ROOTFS/etc/csh.cshrc" + fi for file in $(find "$ROOTFS/etc/profile.d/" -type f) do echo '' >> $file # 防止配置文件末尾没有换行符的情况