博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sh cssupdate
阅读量:6880 次
发布时间:2019-06-27

本文共 1204 字,大约阅读时间需要 4 分钟。

shell sh 更新 css图片版本

#!/bin/bashcsstmpl_path="/home/fdipzone/php/csstmpl"css_path="/home/fdipzone/php/css"replacetags=(".png" ".jpg" ".gif")convertnum=0search_child=$1echo ${search_child:=0} > /dev/nullfunction create(){    tmplfile=$1    dfile=$2    css_content=$(cat $tmplfile)    dfolder=${dfile%/*}    if [ ! -d "$dfolder" ]; then        mkdir -p $dfolder    fi    for tag in ${replacetags[*]} ; do        newtag="$tag?$(date +%Y%m%d%H%M%S)"        css_content=${css_content//$tag/$newtag}    done    echo $css_content > $dfile    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

转载于:https://www.cnblogs.com/fdipzone/archive/2013/02/10/3715137.html

你可能感兴趣的文章
聊聊eureka的delta配置
查看>>
Masonry 源码解读(下)
查看>>
Swift如何给应用添加3D Touch菜单
查看>>
05_Node js 文件管理模块 fs
查看>>
关于python中可迭代对象和迭代器的一些理解
查看>>
界面无小事(五):自定义TextView
查看>>
ES6读书笔记(三)
查看>>
视频播放器全屏旋转方案
查看>>
根据调试工具看Vue源码之生命周期(一)
查看>>
RxJS教程
查看>>
在高并发环境下Reids做缓存踩坑记录
查看>>
通俗易懂--岭回归(L2)、lasso回归(L1)、ElasticNet讲解(算法+案例)
查看>>
Word类报表实例 - 质量检测报告
查看>>
Java进阶篇设计模式之二 ----- 工厂模式
查看>>
2018以太坊编程语言solidity最佳IDE
查看>>
hey,你的CommonJS规范
查看>>
定位?
查看>>
《工具癖》从Github下载开源电子书
查看>>
让Vue的v-for支持迭代器遍历
查看>>
微服务架构基础之API网关
查看>>