-
编码要求:ascii或者utf-8,其他编码不保证能正常工作
小心:程序可能产生二义性表达式:a + ++b压缩后变成a+++b等效于a++ + b,结果错误所以这样的代码应该写成a + (++b)
建议: -
#!/bin/sh
#filename: jssmin.sh
#usage: jssmin.sh [file1 file2 file3 ...]
if [ ! -x /path/to/jsmin ]; then
echo "jsmin not found";
exit;
fi
for FILENAME in $@; do
if [ ! -f $FILENAME ]; then
continue;
fi
mv $FILENAME ${FILENAME}.bak;
echo ">>> original file backuped: ${FILENAME}.bak";
cat ${FILENAME}.bak | jsmin > $FILENAME;
done
阅读(1864) | 评论(0) | 转发(0) |