sh cssupdate 优化
来源:互联网 发布:淘宝如何复制宝贝 编辑:程序博客网 时间:2024/05/22 06:10
#!/bin/bash# 更新css文件内图片的版本# 如background:url('images/test.jpg'); 更新为 background:url('images/test.jpg?20130330121210');csstmpl_path="/home/fdipzone/php/csstmpl" # css tmpl pathcss_path="/home/fdipzone/php/css" # css pathreplacetags=(".png" ".jpg" ".gif") # file typeconvertnum=0search_child=$1 # search childecho ${search_child:=0} > /dev/nullfunction create(){ tmplfile=$1 dfile=$2 dfolder=${dfile%/*} if [ ! -d "$dfolder" ]; then mkdir -p $dfolder fi cp "$tmplfile" "$dfile" #复制tmpl到目标文件 for tag in ${replacetags[*]} ; do newtag="$tag?$(date +%Y%m%d%H%M%S)" sed -i "s/$tag/$newtag/g" "$dfile" #使用sed -i 替换文件内容 done convertnum=$(($convertnum+1)) tolog "$tmplfile convert to $dfile success"}function tolog(){ echo $1}function update(){ if [ -d "$csstmpl_path" ] && [ -d "$css_path" ]; then if [ "$search_child" -eq 0 ]; then maxdepth=" -maxdepth 1 " else maxdepth="" fi for file in $(find $csstmpl_path $maxdepth -name "*.css" -type f) ; do dfile=${file/$csstmpl_path/$css_path} create $file $dfile done echo "convert num: $convertnum" else tolog "$csstmpl_path or $css_path not exists" fi}updateexit 0
查看PHP版
查看上一版
- sh cssupdate 优化
- sh cssupdate
- install_zj.sh脚本优化
- Tomcat catalina.sh 优化
- sh
- jvm优化-catalina.sh JAVA_OPTS参数说明与配置
- 有关sh脚本,优化svn管理android事务
- 几个 Ceph 性能优化的新方法和思路(2015 SH Ceph Day 参后感)
- weblogstop.sh
- man sh
- stopMS01.sh
- stopAdmin.sh
- RunWebserver.sh
- 20070910sh
- .sh打包
- create_db_sybase.sh
- svn_install_script.sh
- GendaTa.sh
- 男士达人iPad版
- iPhone开发实战:定位与地图
- 内核中的等待队列
- Soft Computing : Course Content, Lecture Note, Slides, Text books, References
- 两年内从零到每月十亿 PV 的发展来谈 Pinterest 的架构设计
- sh cssupdate 优化
- j2EE的简单web开发项目
- 问题一百三十二:自然数对
- NSNotificationCenter 处理自定义消息
- apache mima 过滤器
- 动态创建html内容时所用的W3C DOM属性和方法
- 第十一届北京师范大学程序设计竞赛(网络同步赛)+沙漠之旅
- 使用JS编写一段面向对象的代码
- Windows下搭建MySQL集群