"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "littleutils/filehash_clone.sh" between
littleutils-1.2.3.tar.lz and littleutils-1.2.4.tar.lz

About: littleutils are a collection of small and simple utilities (rename files, search for duplicate files, ...).

filehash_clone.sh  (littleutils-1.2.3.tar.lz):filehash_clone.sh  (littleutils-1.2.4.tar.lz)
#! /bin/sh #! /bin/bash
# vim: set filetype=sh: # vim: set filetype=bash:
# filehash_clone.sh: Print various hash digests and filesizes for the specified # filehash_clone.sh: Print various hash digests and filesizes for the specified
# files or subsets of those files (just like filehash) # files or subsets of those files (just like filehash)
# Copyright (C) 2020 by Brian Lindholm. This file is part of the littleutils # Copyright (C) 2020-2021 by Brian Lindholm. This file is part of the
# utility set. # littleutils utility set.
# #
# The repeats utility is free software; you can redistribute it and/or modify # The repeats utility is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the Free # it under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later version. # Software Foundation; either version 3, or (at your option) any later version.
# #
# The repeats utility is distributed in the hope that it will be useful, but # The repeats utility is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details. # more details.
# #
skipping to change at line 36 skipping to change at line 36
SHA256='n' SHA256='n'
SHA384='n' SHA384='n'
SHA512='n' SHA512='n'
B2_256='n' B2_256='n'
B2_512='n' B2_512='n'
COUNT='' COUNT=''
SKIP='' SKIP=''
while getopts 12345678chn:o: opts while getopts 12345678chn:o: opts
do do
case $opts in case $opts in
1) MD5=y ;; 1) MD5='y' ;;
2) SHA1=y ;; 2) SHA1='y' ;;
3) SHA224=y ;; 3) SHA224='y' ;;
4) SHA256=y ;; 4) SHA256='y' ;;
5) SHA384=y ;; 5) SHA384='y' ;;
6) SHA512=y ;; 6) SHA512='y' ;;
7) B2_256=y ;; 7) B2_256='y' ;;
8) B2_512=y ;; 8) B2_512='y' ;;
h) echo 'filehash LU_VERSION' h) echo 'filehash LU_VERSION'
echo 'usage: filehash [-1(MD5)] [-2(SHA1)] [-3(SHA224)] [-4(SHA256)]' echo 'usage: filehash [-1(MD5)] [-2(SHA1)] [-3(SHA224)] [-4(SHA256)]'
echo ' [-5(SHA384)] [-6(SHA512)] [-7(BLAKE2B_256)] [-8(BLAKE2B_25 6)]' echo ' [-5(SHA384)] [-6(SHA512)] [-7(BLAKE2B_256)] [-8(BLAKE2B_25 6)]'
echo ' [-h(elp)] [-n byte_count] [-o byte_offset] file...' echo ' [-h(elp)] [-n byte_count] [-o byte_offset] file...'
exit 0 ;; exit 0 ;;
n) COUNT="count=$OPTARG" ;; n) COUNT="count=$OPTARG" ;;
o) SKIP="skip=$OPTARG" ;; o) SKIP="skip=$OPTARG" ;;
*) echo 'filehash LU_VERSION' *) echo 'filehash LU_VERSION'
echo 'usage: filehash [-1(MD5)] [-2(SHA1)] [-3(SHA224)] [-4(SHA256)]' echo 'usage: filehash [-1(MD5)] [-2(SHA1)] [-3(SHA224)] [-4(SHA256)]'
echo ' [-5(SHA384)] [-6(SHA512)] [-7(BLAKE2B_256)] [-8(BLAKE2B_25 6)]' echo ' [-5(SHA384)] [-6(SHA512)] [-7(BLAKE2B_256)] [-8(BLAKE2B_25 6)]'
echo ' [-h(elp)] [-n byte_count] [-o byte_offset] file...' echo ' [-h(elp)] [-n byte_count] [-o byte_offset] file...'
exit 1 ;; exit 1 ;;
esac esac
done done
shift `expr ${OPTIND} - 1` shift $((${OPTIND}-1))
# compute hashes as requested # compute hashes as requested
if [ "X$COUNT" = 'X' -a "X$SKIP" = 'X' ]; then if [ "X$COUNT" = 'X' -a "X$SKIP" = 'X' ]; then
for IDX in "$@" ; do for IDX in "$@" ; do
if [ "$MD5" = 'y' ]; then md5sum $IDX ; fi if [ "$MD5" = 'y' ]; then md5sum "$IDX" ; fi
if [ "$SHA1" = 'y' ]; then sha1sum $IDX ; fi if [ "$SHA1" = 'y' ]; then sha1sum "$IDX" ; fi
if [ "$SHA224" = 'y' ]; then sha224sum $IDX ; fi if [ "$SHA224" = 'y' ]; then sha224sum "$IDX" ; fi
if [ "$SHA256" = 'y' ]; then sha256sum $IDX ; fi if [ "$SHA256" = 'y' ]; then sha256sum "$IDX" ; fi
if [ "$SHA384" = 'y' ]; then sha384sum $IDX ; fi if [ "$SHA384" = 'y' ]; then sha384sum "$IDX" ; fi
if [ "$SHA512" = 'y' ]; then sha512sum $IDX ; fi if [ "$SHA512" = 'y' ]; then sha512sum "$IDX" ; fi
if [ "$B2_256" = 'y' ]; then b2sum -l 256 $IDX ; fi if [ "$B2_256" = 'y' ]; then b2sum -l 256 "$IDX" ; fi
if [ "$B2_512" = 'y' ]; then b2sum -l 512 $IDX ; fi if [ "$B2_512" = 'y' ]; then b2sum -l 512 "$IDX" ; fi
done done
else else
for IDX in "$@" ; do for IDX in "$@" ; do
if [ "$MD5" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | md5sum if [ "$MD5" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | md5su
| sed -e "s/-$/$IDX/" ; fi m | sed -e "s/-$/$IDX/" ; fi
if [ "$SHA1" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | sha1su if [ "$SHA1" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | sha1
m | sed -e "s/-$/$IDX/" ; fi sum | sed -e "s/-$/$IDX/" ; fi
if [ "$SHA224" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | sha2 if [ "$SHA224" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | sh
24sum | sed -e "s/-$/$IDX/" ; fi a224sum | sed -e "s/-$/$IDX/" ; fi
if [ "$SHA256" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | sha2 if [ "$SHA256" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | sh
56sum | sed -e "s/-$/$IDX/" ; fi a256sum | sed -e "s/-$/$IDX/" ; fi
if [ "$SHA384" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | sha3 if [ "$SHA384" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | sh
84sum | sed -e "s/-$/$IDX/" ; fi a384sum | sed -e "s/-$/$IDX/" ; fi
if [ "$SHA512" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | sha5 if [ "$SHA512" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | sh
12sum | sed -e "s/-$/$IDX/" ; fi a512sum | sed -e "s/-$/$IDX/" ; fi
if [ "$B2_256" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | b2su if [ "$B2_256" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | b2
m -l 256 | sed -e "s/-$/$IDX/" ; fi sum -l 256 | sed -e "s/-$/$IDX/" ; fi
if [ "$B2_512" = 'y' ]; then dd status=none if=$IDX bs=1 $COUNT $SKIP | b2su if [ "$B2_512" = 'y' ]; then dd status=none if="$IDX" bs=1 $COUNT $SKIP | b2
m -l 512 | sed -e "s/-$/$IDX/" ; fi sum -l 512 | sed -e "s/-$/$IDX/" ; fi
done done
fi fi
 End of changes. 6 change blocks. 
37 lines changed or deleted 37 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)