comparison bin/putcrc @ 102:7a287a518718

Merge.
author Edho Prima Arief <edho@myconan.net>
date Thu, 18 Aug 2011 15:20:54 +0700
parents 08d5f6023998
children
comparison
equal deleted inserted replaced
89:29bd7f6ef58a 102:7a287a518718
22 if [ -f "${file}" ] && [ -r "${file}" ] && [ -n "$(printf "%s\n" "${file}" | sed -e 's/.*[A-F0-9]\{8\}.*//')" ]; then 22 if [ -f "${file}" ] && [ -r "${file}" ] && [ -n "$(printf "%s\n" "${file}" | sed -e 's/.*[A-F0-9]\{8\}.*//')" ]; then
23 filename="$(basename "$(safe_path "${file}")")" 23 filename="$(basename "$(safe_path "${file}")")"
24 dirname="$(dirname "$(safe_path "${file}")")" 24 dirname="$(dirname "$(safe_path "${file}")")"
25 myfile="$(printf "%s\n" "${filename%.*}" | sed -e 's/\([^]]\)$/\1 /')" 25 myfile="$(printf "%s\n" "${filename%.*}" | sed -e 's/\([^]]\)$/\1 /')"
26 myext="${filename##*.}"; if [ "${myext}" = "${filename}" ]; then myext=""; else myext=".${myext}"; fi 26 myext="${filename##*.}"; if [ "${myext}" = "${filename}" ]; then myext=""; else myext=".${myext}"; fi
27 crc=$(cek.rb "$(safe_path "${file}")" | tail -1 | sed -e 's/.*\([A-F0-9]\{8\}\)$/\1/') 27 crc=$(cek.py "$(safe_path "${file}")" | tail -1 | sed -e 's/.*\([A-F0-9]\{8\}\)$/\1/')
28 mv -- "${file}" "${dirname}/${myfile}[${crc}]${myext}" && printf "%s => %s\n" "${file}" "${myfile}[${crc}]${myext}" 28 mv -- "${file}" "${dirname}/${myfile}[${crc}]${myext}" && printf "%s => %s\n" "${file}" "${myfile}[${crc}]${myext}"
29 else 29 else
30 printf "%s\n" "${file} is not a file or unreadable" 30 printf "%s\n" "${file} is not a file or unreadable"
31 fi 31 fi
32 done 32 done