Adobe可以选择下载字体,这是我们这个行业的一个问题。我找到了这些文件的位置,现在我想创建一个Jamf智能组来检查字体是否已经下载。
文件位置为/Users/$loggedInUser/Library/Application\ Support/Adobe/CoreSync/plugins/livetype/.r/。
文件名是数字的组合。示例:.33805.otf。
到目前为止,我使用了下面的方法,但它不起作用。我一直得到一个False输出。
USERS="`ls /Users | grep -v "Shared"`"
for Adobe in $USERS; do
if [[ -a "/Users/$Adobe/Library/Application\ Support/Adobe/CoreSync/plugins/livetype/.r/.[^.]*otf" ]] ; then
echo "True"
else
echo "False"
fi
done发布于 2020-02-16 00:45:46
You really want to avoid ls here.一个更健壮和可移植的解决方案是简单地循环匹配。
开箱即用,shell不会在一般的glob结果中包含点文件;但是,如果您在通配符中包含一个点,它将正常地展开它。
但是,不能在通配符两边使用双引号;这样做会将*的含义从通配符字符更改为文字星号(对于?、[等其他通配符也是如此)。
for user in /Users/*; do
case $user in *Shared*) continue;; esac
for file in "$user/Library/Application Support/Adobe/CoreSync/plugins/livetype/.r/".[!.]*otf; do
if [[ -a "$file" ]]; then
echo "True"
else
echo "False"
fi
break
done
donedouble for循环不是很直观,但是这是一个很好的检查通配符是否匹配任何文件的好方法。开始一个循环,但只执行第一次迭代;如果第一个文件不存在,这意味着shell无法展开通配符,并逐字返回它。(这是默认和遗留的Bourne shell行为;现代shell具有nullglob等,一些管理员喜欢为所有新用户启用这些行为。)
发布于 2020-02-14 06:08:25
shopt -s dotglob
for adobe in /users/*; do
[[ $adobe == *Shared* ]] && continue ##: skip the Shared match
# do the rest of the stuff here
donehttps://stackoverflow.com/questions/60102961
复制相似问题