Common Desktop Environment: Desktop KornShell User's Guide

Using script_find

The script, script_find, demonstrates how you can use dtksh to provide a graphical interface to the find command. script_find produces a window within which you can specify parameters for the find command. To fully understand the script, you should be familiar with the find command and you should have its man page available. A number of the toggle button menu choices in the window produced by script_find require some knowledge of the find command.

The script's window allows you to specify a search directory and a file name. Other options allow you to place restrictions on the type of file system to search and the file type on which to match. Figure 4-1 shows the script's window.

Figure 4-1 Window for script_find

Graphic

Enter the search directory and file name you're looking for in the text fields at the top of the window. In addition, select any applicable choice (or choices) from the five toggle buttons. You can further restrict the search with the option menus. When you have made all the necessary selections, click OK. If all is well, a window appears shortly thereafter and displays the results of the find operation. An error dialog appears if you don't specify a search directory or file name, or if the specified search directory is invalid. For example, suppose you want to find a file called two_letter_calls, and you think it resides somewhere in the directory /users/dlm. When you enter the directory in the Search Directory text field, you inadvertently type /users/dln instead of /users/dlm. When you click OK or Apply, script_find can't find the directory /users/dln, so it creates the error dialog to notify you of this.

Figure 4-2 script_find error Dialog

Graphic

When you correct the mistake, script_find then executes properly and creates a dtterm window within which it displays the complete path of the file you requested, providing that the file is found.

Figure 4-3 Window Showing Complete Path

Graphic

If script_find cannot find the file in the specified directory, nothing appears in the dtterm window.