[comp.sys.amiga.programmer] Script for managing HD assigns

brianr@tekig1.PEN.TEK.COM (Brian E Rhodefer) (06/09/91)

Hi all.  Suffering through the teething problems of my month-old A3000, which
goes back to the dealer for its *second* replacement motherboard next week,
I've done quite a bit of low-level formatting, backup restoration, and software
re-re-re-re-installation.  Along the way, I polished up a script that I use
to manipulate a list of startup assignments, to the point that it might be
of general use.

I keep a script file in my S: directory, called "AssignHD", exclusively
consisting of assign commands, that's invoked during my startup sequence
(fairly common practice, I'll bet).  As new software packages are installed,
this script file needs to be updated, of course, and, if one wishes to use
such software immediately after installation, one must do a "real" assign, too.

My script, which I call "PAS" (mnemonic of "Permanent ASsign"), lets you do all
this with one CLI transaction.  If you've got some new game that wants to refer
to the "Coconut:" volume, you can just type "PAS coconut: games:sillypath" or
somesuch, and everything is handled.  Later, if you erase the game, you
can type "pas coconut:", and the appropriate line in the "AssignHD" file will
be removed.

The name of the assignment script file is hard-coded in the following script,
but it should be a simple matter to change it to suit your preferences.
Remember to set the script bit on PAS (or whatever you name it).

------------->cut here<-------------------------
.key volume/a,pathname
.bra {
.ket }

; Redirected to nil: because "quiet" isn't:
search >nil: from s:AssignHD {volume} quiet
if not warn
echo > t:ecf{$$} "F U/{volume}/;D;W"
edit s:assignhd with t:ecf{$$}

; Gee, wouldn't it be nice if Commodore's own editors
; knew about AmigaDOS file protection bits?
protect s:assignhd +s

echo "Removed old assignment for {volume}"
delete  t:ecf{$$} quiet
endif

;
if not {pathname} gt "" ; Add or remove assignments?
;
; Null string for "new" pathname means we try to un-assign it.
;
assign {volume}
else

if exists {pathname}
echo > t:pas{$$} "Assign {volume} {pathname}"
execute t:pas{$$}
type >> s:AssignHD t:pas{$$}
delete t:pas{$$} quiet
else
echo "I can't seem to find {pathname}."
endif

endif
;--------------->End of PAS script file<------------

Brian Rhodefer