MAC中用Shell脚本批量裁剪各种尺寸的App图标
在APP上架前,一次一次自己剪裁上架需要的各个尺寸的Icon不是程序员该干的事,使用Mac中自带的sips工具可以解决这个需求。
关于sips,在终端中直接执行可以出现以下信息:
sips 10.4.4 - scriptable image processing system.
This tool is used to query or modify raster image files and ColorSync ICC profiles.
Its functionality can also be used through the "Image Events" AppleScript suite.
Try 'sips --help' or 'sips --helpProperties' for help using this tool
它一个脚本图像处理系统,可用于查询和修改图像文件。
下面是刚写的IOS App Icon裁剪脚本,保存成一个.sh文件,在终端里输入sh xx.sh就可以执行了:
#!/bin/sh
filename="icon.png"
dirname="cutimg"
name_array=("Icon-29.png" "Icon-29@2x.png" "Icon-40@2x.png" "Icon-57.png" "Icon-57@2x.png" "Icon-120.png")
size_array=("29" "58" "80" "57" "114" "120")mkdir $dirname
for ((i=0;i<${#name_array[@]};++i)); do
m_dir=$dirname/${name_array[i]}
cp $filename $m_dir
sips -Z ${size_array[i]} $m_dir
done
Shell脚本判断IP地址是否合法的方法
使用shell校验IP地址合法性使用方法:[root@yangpython]#bashcheck_ip.shIP地址执行结果:返回值0校验合法,非0不合法。shell代码:[root@yangpython]#vicheck_ip.sh#!/usr/bi
Shell脚本监控服务器在线状态和邮件报警的方法
对于服务器来说在线率很重要,出现问题要能及时解决,但系统管理员不能一直守在电脑旁边,通过脚本监控网站出现问题及时通过mail通知管理员,如
25个好用的Shell脚本常用命令分享
1.列出所有目录使用量,并按大小排序。ls|xargsdu-h|sort-rn#不递归下级目录使用du-sh2.查看文件排除以#开关和空白行,适合查看配置文件。egrep-v"^#|^$"filename
编辑:广州明生医药有限公司
标签:脚本,在线,终端,地址,上架