Download Axis 2401 - PHP3 GUIDE System information
Transcript
An Introduction to Shells in General while [ expression ]; do statements done The until statement The until statement is very similar in syntax and function to the while statement. The only real difference between the two is that the until statement executes its code block while its conditional expression is false, and the while statement executes its code block while its conditional expression is true. The syntax for the until statement is: until [ expression ] do commands done In practice the until statement is not very useful, because any until statement you write can also be written as a while statement. The shift command The shift command moves the current values stored in the positional parameters to the left one position. For example, if the values of the current positional parameters are $1 = -r $2 = file1 $3 = file2 and you executed the shift command shift the resulting positional parameters would be: $1 = file1 $2 = file2 You can also move the positional parameters over more than 1 place, by specifying a number with the shift command. The following would shift the positional parameters two places: shift 2 This is a very useful command when you have a shell program that needs to parse command line options. This is true because options are typically preceded by a hyphen and a letter that indicates what the option is to be used for. Because options are usually processed in a loop of some kind, you often want to skip to the next positional parameter once you have identifiedwhich option should be coming next. Axis Communications AB provides NO support for application development of any kind. The information here is provided "as is", and there is no guarantee that any of the examples shown will work in your particular application. Revision 1.02 October 2002 69