#!/bin/bash 
# Program name: using usb.sh
# Description: The script can auto mount your usb storage.
# Support OS: Fedora 1 ~ 3, Redhat 8 ~ 9,  Redhat Enterprise 3 ~ 4
# Programmer: Tzu-Yi Liao (steven@eic.com.tw)

if [ ! -d /mnt/usb ]; then echo "You must creat the /mnt/usb directory."; exit; fi
mount /dev/sda /mnt/usb > /dev/null 2>&1;
if [ $? == 0 ]; then
	echo "Good, use you USB !";
	echo "Your usb directory is /mnt/usb/";
	echo "";
else
	umount /mnt/usb > /dev/null 2>&1;
	if [ $? == 0 ]; then
		echo "Unmount USB !";
		echo "";
	else
		echo "	Oops, Cannot unmount your USB storage. :(";
		echo "	Check if it is in used?";
		echo "		Check tools: fuser /mnt/usb";
		echo "	Make sure the /mnt/usb is not in used, and try again :)";
		echo ""
		read tmp_var;
		unset tmp_var;
	fi
fi

#read tmp_var;
#unset tmp_var;
