goto $SMEI/com/linux/goto
[Previous] [Next]
 NAME:
	goto
 PURPOSE:
	Mounting/unmounting of removable disks (floppy,cdrom,zip)
 CALLING SEQUENCE
	goto 'drive'
 RESTRICTIONS:
	'drive' must be listed in /etc/fstab
 PROCEDURE:
 >	After checking /etc/fstab, the mount command is piped
	through grep searching for 'drive'. If present the
	drive is mounted.
 >	When bash is the default shell aliases can be defined as:
	    alias floppy=". goto floppy"
	    alias cdrom=". goto cdrom"
	    alias zip=". goto zip"
	(i.e. the script is sourced)
	In other shells (e.g. csh) the aliases need to be defined as
	    alias floppy "$COM/goto floppy"
 >	If 'drive' is not mounted yet then it is mounted, and
	a 'cd' is made to the root directory 'drive'
 >	If 'drive' is mounted, then it is umounted. If the
	current directory is on 'drive' then a 'cd' is made
	to the previous working directory $OLDPWD. If this fails
	then a 'cd' to the user home directory follows.
 MODIFICATION HISTORY:
	FEB-2001, Paul Hick (UCSD/CASS)
	FEB-2003, Paul Hick (UCSD/CASS)
	    Fixed problem detecting non-existing mount points
	FEB-2003, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
	    Instead of testing for "drive" test for "drive ".
	    The added space should avoid problems when e.g.
	    cdrom and cdrom1 exist.