【发布时间】:2014-07-04 13:28:41
【问题描述】:
我无法让这个程序处理带有空格的文件。 即使我修改它以使代码在每个空格之前都有“\”,它也会不断出错
发生的事情是我在网上找到了这段代码,当你发送信息并且文件没有空格时,它作为一个 shell 脚本工作,现在我正试图让它在 automator 和任何文件中工作
iconSource="$1"
iconDestination="$2"
newiconSource="${iconSource}"
newiconDestination="${iconDestination}"
echo $newiconSource
echo $newiconDestination
icon=/tmp/`basename $newiconSource`
rsrc=/tmp/icon.rsrc
# Create icon from the iconSource
cp $newiconSource $icon
# Add icon to image file, meaning use itself as the icon
sips -i $icon
# Take that icon and put it into a rsrc file
DeRez -only icns $icon > $rsrc
# Apply the rsrc file to
SetFile -a C $newiconDestination
if [ -f $newiconDestination ]; then
# Destination is a file
Rez -append $rsrc -o $newiconDestination
elif [ -d $newiconDestination ]; then
# Destination is a directory
# Create the magical Icon\r file
touch $newiconDestination/$'Icon\r'
Rez -append $rsrc -o $newiconDestination/Icon?
SetFile -a V $newiconDestination/Icon?
fi
【问题讨论】:
标签: bash directory icons automator