Message-ID: <49DA3001.7040005@x68k.net> Date: Mon, 06 Apr 2009 16:38:25 +0000 From: Seisei_Yamaguchi Reply-To: seisei@x68k.net Organization: Earth User-Agent: Thunderbird 2.0.0.17 (BeOS/20080930) MIME-Version: 1.0 Subject: Generate cksums script . Beta . Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Newsgroups: alt.sources,fj.sources,misc.test,microsoft.public.test NNTP-Posting-Host: nissin20172.ccnw.ne.jp 218.216.217.172 Lines: 97 Path: news.ccsf.jp!tomockey.ddo.jp!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!novso.com!news.skynet.be!news.stack.nl!news4us.nl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP06.phx.gbl Xref: news.ccsf.jp fj.sources:279 X-Original-Lines: 1 Archive-name: gen_-_cksums_sh.shar Submitted-by: seisei@x68k.net Beta . For duplicating directory tree . # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # # echo x - gen_-_cksums_sh sed 's/^X//' >gen_-_cksums_sh << 'END-of-gen_-_cksums_sh' X#!/bin/sh X# Seisei Yamaguchi 0020080818 X# X# Generate cksums script . X# X# ToDo : X# * Check existent of dir_and_file at target directories . X# * uname . X# * Copy and compare ( it is too bad , on cache ) . X# * xargs for copy and compare each file before copying next file . X Xstr__command__cksum='cksum' X#str__command__cksum='cksum -o 3' X X Xstr__regexp__linehead='^' Xstr__regexp__dot='\.' Xstr__regexp__dirname__working_dir=$str__regexp__linehead$str__regexp__dot X Xstr__filename__me=`basename $0` Xstr__dirname__tmp=$HOME'/var/tmp/'$str__filename__me'/'$$ Xstr__filename__dir_only=$str__dirname__tmp'/lines_-_dironly.'$$ X X Xquoting(){ X sed -e "s/'/'\\\''/g" | sed -e "s/^/'/" | sed -e "s/$/'/" X} X Xdel__linehead__dotslash(){ X sed -e 's@'$str__regexp__dirname__working_dir'/@@' X} X Xlist__dironly(){ X str__option__ls__print_non_printable_characters='w' # FreeBSD X# str__option__ls__print_non_printable_characters='v' # D?rwin X X# ls -R1w \ X ls -R1$str__option__ls__print_non_printable_characters \ X | egrep $str__regexp__dirname__working_dir'/.*:$' \ X | del__linehead__dotslash | sed -e 's@:$@@' \ X# | sort X} X Xlist__dir_and_file(){ X find . -depth -print | del__linehead__dotslash \ X | egrep -v ^\.$ | sort X} X Xgen__gen_cksums(){ X str__command__get__list__fileonly="list__dir_and_file \ X | comm -2 -3 /dev/stdin $str__filename__dir_only" X# | diff /dev/stdin $str__filename__dir_only \ X# | egrep '^[<>] ' | sed -e 's/^[<>] //'" X X eval $str__command__get__list__fileonly \ X | quoting \ X | sed -e "s@"$str__regexp__linehead"@"$str__command__cksum" @" X} X X Xmkdir -p $str__dirname__tmp Xlist__dironly > $str__filename__dir_only X X Xecho '#!/bin/sh' Xgen__gen_cksums X Xrm $str__filename__dir_only Xrmdir $str__dirname__tmp X END-of-gen_-_cksums_sh exit -- Seisei Yamaguchi (str_h__name = {"1st"=>jp( "青星" ),"family"=>jp( "山口" )}) http://hello.to/seisei/ mailto:seisei@x68k.net tel:081-70-5152-1104 The peace and the free-sex as one .