From edb43243c72c55d5416254280ea9ee44cd9816ee Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Wed, 12 May 2010 20:54:49 -0700 Subject: [PATCH] mbr_dump.sh: should check script arguments better --- mbr_dump.sh | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mbr_dump.sh b/mbr_dump.sh index dce7962..d97e450 100755 --- a/mbr_dump.sh +++ b/mbr_dump.sh @@ -6,14 +6,22 @@ # # Colin McCabe # +usage() { + echo "usage: ${0} " + echo "should be 512 bytes in length." + exit 1 +} + +if [ $# -ne 1 ]; then + usage +fi if [ -e ${1} ]; then PART_FILE=${1} else - echo "usage: ${0} " - echo "should be 512 bytes in length." - exit 1 + usage fi + echo "# first partition" od -j 446 -N 16 -t x1 ${1} echo "# second partition" -- 1.6.6.rc1.39.g9a42