Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generate cksums script . Beta .

1 view
Skip to first unread message

Seisei_Yamaguchi

unread,
Apr 6, 2009, 12:38:25 PM4/6/09
to
Archive-name: gen_-_cksums_sh.shar
Submitted-by: sei...@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:sei...@x68k.net tel:081-70-5152-1104
The peace and the free-sex as one .

0 new messages