next up previous contents index
Next: @map Up: Distributed Macros Previous: @change_id_number

@Save_as

First an elaborate example of the @Save_as macro, where we make of the UNIX operating system to change the content of the FILE_O_SAVE datablock.

! O Macro to change the Save file name

write file_o_save tmp ;

! Use UNIX to change last line of datablock
$ head -1 tmp > tmp1 
$ echo "New Save file? \c"
$ read file ; echo $file >> tmp1

! Read back the changed datablock
read tmp1
print "The new save file is called"
write file_o_save ;;

! Clean up after us
$ /bin/rm tmp tmp1

bell
print "Save file name changed"

A simpler approach to the above is to delete the FILE_O_SAVE datablock, and take advantage of the fact that Save asks for a filename if it doesn't exist:

 
db_kill FILE_O_SAVE
save #New file name :#