#!/bin/bash
# This script gives information about a file.
#      (formerly bex1.sh)

ME=`basename $0`

if [ $# -eq 0 ]; then
    echo "Usage: "$ME" [filename]"
    exit 1
fi

FILENAME="$1"

if [ -z "$FILENAME" ] ; then
  echo "Usage: ./bex1.sh [filename]"
  exit 0
fi

echo " "$ME" [filename] "
if [ -e $FILENAME ] ; then
  echo "Properties for $FILENAME:"
  echo "Size is $(ls -lh $FILENAME | awk '{ print $5 }')"
  echo "Type is $(file $FILENAME | cut -d":" -f2 -)"
  echo "Inode number is $(ls -i $FILENAME | cut -d" " -f1 -)"
  echo "$(df -h $FILENAME | grep -v Mounted | awk '{ print "On",$1", \
which is mounted as the",$6,"partition."}')"
else
  echo "File does not exist."
fi


