Changes between Version 1 and Version 2 of waue/2009/0521


Ignore:
Timestamp:
May 21, 2009, 2:14:50 PM (15 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2009/0521

    v1 v2  
    55{{{
    66#!/bin/sh
    7 
    8 
    9 
    107cd ~/test2
    11 
    128echo `pwd`
    13 
    149for i in *.[tT][iI][fF]; do
    15 
    1610        #若目錄內無 .tif 檔案 $i 會傳回 "*.[tT][iI][fF]"
    17 
    1811        if [ "$i" != "*.[tT][iI][fF]" ]; then
    19 
    2012                #取得副檔名
    21 
    2213                subname="`echo $i | awk -F '.' '{print $NF}'`"
    23 
    2414                #取得主檔名
    25 
    2615                filename="`echo $i | sed -e s/\.${subname}//`"
    27 
    2816                #將 .tif 轉成 .pdf
    29 
    3017                #tiff2pdf -o "${filename}.pdf" "$i"
    31 
    3218                echo "tif -> pdf"
    33 
    3419                mv ${filename}.${subname} ${filename}.pdf
    35 
    3620                #若執行成功則刪除 .tif 檔案
    37 
    3821                if [ $? -eq 0 ]; then
    39 
    4022                        rm -rf $i
    41 
    4223                fi
    43 
    4424        fi
    45 
    4625done
    4726}}}
     
    5029{{{
    5130Examples:
    52 
    5331        gawk '{ sum += $1 }; END { print sum }' file
    54 
    5532        gawk -F: '{ print $1 }' /etc/passwd
    5633}}}
     
    5936{{{
    6037Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
    61 
    62 
    63 
    6438  -n, --quiet, --silent
    65 
    66                  suppress automatic printing of pattern space
    67 
     39                suppress automatic printing of pattern space
    6840  -e script, --expression=script
    69 
    7041                 add the script to the commands to be executed
    7142}}}