leading zero

This commit is contained in:
Bob Mottram 2017-04-20 10:55:33 +01:00
parent da18dc225e
commit c6eb3de0d1
1 changed files with 4 additions and 4 deletions

View File

@ -391,11 +391,11 @@ function domain_to_hex_string {
do
characters=$(echo -n "$segment" | wc -c)
hexnum=$(echo "obase=16; $characters" | bc)
if [ ${hexnum} -lt 2 ]; then
echo -n "|0${hexnum}|$segment"
else
echo -n "|$hexnum|$segment"
echo -n "|"
if [ $(echo -n "$hexnum" | wc -c) -lt 2 ]; then
echo -n "0"
fi
echo -n "$hexnum|$segment"
ctr=$((ctr + 1))
segment=$(echo "$domain" | awk -F '.' -v value="$ctr" '{print $value}')
done