commit bash-20110203 snapshot

This commit is contained in:
Chet Ramey
2011-12-12 22:15:55 -05:00
parent ba3a2ee127
commit 285035f729
78 changed files with 9635 additions and 70 deletions
+5 -7
View File
@@ -12,8 +12,7 @@
# bash-hexdump# pure Bash, no externals
# by Dennis Williamson - 2010-01-04
# in response to
http://stackoverflow.com/questions/2003803/show-hexadecimal-numbers-of-a-fil
e
http://stackoverflow.com/questions/2003803/show-hexadecimal-numbers-of-a-file
# usage: bash-hexdump file
saveIFS="$IFS"
IFS="" # disables interpretation of \t, \n and space
@@ -24,9 +23,9 @@ valcount=0
printf "%08x " $bytecount
while read -d '' -r -n 1 char # -d '' allows newlines, -r allows \
do
((bytecount++)) # for information about the apostrophe in this printf
command, see #
http://www.opengroup.org/onlinepubs/009695399/utilities/printf.html
((bytecount++))
# for information about the apostrophe in this printf command, see
# http://www.opengroup.org/onlinepubs/009695399/utilities/printf.html
printf -v val "%02x" "'$char"
echo -n "$val "
((valcount++))
@@ -49,8 +48,7 @@ http://www.opengroup.org/onlinepubs/009695399/utilities/printf.html
fi
done < "$1"
if [[ "$string" != "" ]] # if the last line wasn't full, pad it
out
if [[ "$string" != "" ]] # if the last line wasn't full, pad it out
then
length=${#string}
if (( length > 7 ))