#!/bin/bash shows() { t=$[s/75]; printf "%u sectors" $s if [ $1 -ne 0 ]; then printf " (+%u bytes)" $1; fi printf "=%02u:%02u.%02u\n" $[t/60] $[t%60] $[s-t*75] } if [ "$1" ] then if [ -r "$1" ] then if [ -d "$1" ] then echo "$1: is a directory" else echo "Length info in ISO header: $[$(printf \ "0x%s%s%s%s" $(head -c$[0100130] $1 | tail -c4 \ | od -tx1 | head -1 | cut -c9-))] in $1" if [ "$(ls -l "$1" | head -c1 2>>/dev/null)" != "b" ] then echo -n "Real length of the file: " l=$(wc -c < $1); s=$[l/2048]; shows $[l%2048] fi fi else s="$1" s=$((echo $[s]) 2> /dev/null) if [ "$s" ] && [ $s -gt 0 ] then shows 0 else echo "$1: not readable" 1>&2 fi fi else echo "Usage: $(basename $0) ISO9660-image" 1>&2 echo "or: $(basename $0) number-of-sectors" 1>&2 echo " (this form is useful when having" echo " number of extends from mkisofs)" echo " (c) Jerzy Tarasiuk " fi