📄 lostfile
字号:
#!/bin/csh## lostfile - script to allow users to request file restoration from backups# in a consistent manner. The user simply types 'lostfile' and # they are prompted for all of the necessary information.#onintr quitset noglob# login name or mail alias of whoever is responsible for # retrieving lost filesset mailto = operatorset filename = not_nullset count = 1echo ""echo -n "Enter the login name of the owner of the lost files: "set login = $<echo "Lost files owned by ${login}" >> /tmp/lostxfer$$echo "" >> /tmp/lostxfer$$echo ""echo -n "Were all of the files in the same directory? "set dirsame = $<echo ""echo "Enter the names of lost files, one at a time;"echo "A <CR> with no name ends the querys."echo ""while ( ${filename} != "" ) echo -n "Enter the name of lost file ${count}: " set filename = $< if ( ${filename} != "" ) then echo "Filename: ${filename}" >> /tmp/lostxfer$$ echo -n "Enter the last modification date of ${filename}: " set modtime = $< echo "Modtime: ${modtime}" >> /tmp/lostxfer$$ if ( ( ${dirsame} == "no" ) || ( ${dirsame} == "n" ) ) then echo -n "Give the full pathname of the" echo -n " directory containing ${filename}: " set dirname = $< echo "Directory: ${dirname}" >> /tmp/lostxfer$$ endif echo -n "Was ${filename} a directory? " set dir = $< if ( ( ${dir} == "yes" ) || ( ${dir} == "y" ) ) then echo -n "File was a directory; " >> /tmp/lostxfer$$ echo -n "Do you want subdirectories of ${filename}? " set subdirs = $< if ( ( ${subdirs} == "yes" ) || ( ${subdirs} == "y" ) ) then echo "entire contents wanted." >> /tmp/lostxfer$$ else echo "only the regular files wanted." >> /tmp/lostxfer$$ endif endif echo "" echo "" >> /tmp/lostxfer$$ endif @ count++endif ( ( ${dirsame} == "yes" ) || ( ${dirsame} == "y" ) ) then echo "" echo -n "Give the full pathname of the directory that the files were in: " set dirname = $< echo "All files were in the directory: ${dirname}" >> /tmp/lostxfer$$endifecho ""echo "You will be contacted by mail if further information is needed,"echo "and you will be notified when the files have been retrieved."echo "Your files should be recovered to the best of our ability within" echo "a day or two. Please 'mail ${mailto}' if you have questions or"echo "problems concerning lost files. Thank You."echo ""unalias mailmail -s "Lost file report for $login" ${mailto} < /tmp/lostxfer$$unalias rmrm -f /tmp/lostxfer$$exitquit: echo "Interrupt received, lost aborted" unalias rm unset noglob rm -f /tmp/lostxfer$$
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -