Changes between Version 1 and Version 2 of waue/2009/0521
- Timestamp:
- May 21, 2009, 2:14:50 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
waue/2009/0521
v1 v2 5 5 {{{ 6 6 #!/bin/sh 7 8 9 10 7 cd ~/test2 11 12 8 echo `pwd` 13 14 9 for i in *.[tT][iI][fF]; do 15 16 10 #若目錄內無 .tif 檔案 $i 會傳回 "*.[tT][iI][fF]" 17 18 11 if [ "$i" != "*.[tT][iI][fF]" ]; then 19 20 12 #取得副檔名 21 22 13 subname="`echo $i | awk -F '.' '{print $NF}'`" 23 24 14 #取得主檔名 25 26 15 filename="`echo $i | sed -e s/\.${subname}//`" 27 28 16 #將 .tif 轉成 .pdf 29 30 17 #tiff2pdf -o "${filename}.pdf" "$i" 31 32 18 echo "tif -> pdf" 33 34 19 mv ${filename}.${subname} ${filename}.pdf 35 36 20 #若執行成功則刪除 .tif 檔案 37 38 21 if [ $? -eq 0 ]; then 39 40 22 rm -rf $i 41 42 23 fi 43 44 24 fi 45 46 25 done 47 26 }}} … … 50 29 {{{ 51 30 Examples: 52 53 31 gawk '{ sum += $1 }; END { print sum }' file 54 55 32 gawk -F: '{ print $1 }' /etc/passwd 56 33 }}} … … 59 36 {{{ 60 37 Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]... 61 62 63 64 38 -n, --quiet, --silent 65 66 suppress automatic printing of pattern space 67 39 suppress automatic printing of pattern space 68 40 -e script, --expression=script 69 70 41 add the script to the commands to be executed 71 42 }}}