-->

Previous | Table of Contents | Next

Page 102

The rmv script asks if you're sure you want to empty the trash. If you type an n, the delete is aborted. If you type a y, the trash is deleted. Because the letter e was found on the command line, the empty variable was set to true and the statements following the if ... then test line were run. The script prints a message to your display, and then, using the read command, waits for you to enter an answer. The answer is then tested, and if yes, the files in the .trash directory are deleted.

Using the shell, you can quickly build simple programs to accomplish major tasks. Feel free to improve this program by adding features or improving on how file names are handled at the command line. One such improvement may be to add the ability to handle wildcards or whole directories. See the bash manual page for more information about other shell commands and operators you can use in your own shell scripts.

Previous | Table of Contents | Next