|
Written by Hemanshu Patel
|
|
Friday, 19 October 2007 |
Controlling Processes Shell scripts were designed to run commands. Up to this point, all the scripts in the book have launched various commands, but all in isolation. The most you’ve seen so far is piping commands to connect the output of one command to the input of another. But the commands run from the scripts do not provide data back to the scripts, other than through writing data to a file. To make processes better fit into shell scripts, you need the capability to start and stop processes, as well as capture the output of processes into shell variables.
|
|
Last Updated ( Sunday, 13 January 2008 )
|
|
|
Controlling How Scripts Run |
|
|
|
|
Written by Hemanshu Patel
|
|
Friday, 19 October 2007 |
Controlling How Scripts Run Once you get beyond some trivial scripts, you’ll soon find that a script that just runs command after command after command doesn’t work for most real-world scripts. Instead, you need the capability to perform some sort of logic within the program, test conditions, and take alternative measures if certain tests fail. You may need to perform some operation on each file in a directory or back up only selected files. Shell scripting languages offer a variety of ways to test values and then execute different commands based on the results of the tests. All of these things fall under the concept of controlling how your scripts run.
|
|
Last Updated ( Sunday, 13 January 2008 )
|
|
|
Written by Hemanshu Patel
|
|
Friday, 19 October 2007 |
Pointers and Arrays A pointer is a variable that contains the address of a variable. Pointers are much used in C, partly because they are sometimes the only way to express a computation, and partly because they usually lead to more compact and efficient code than can be obtained in other ways. Pointers and arrays are closely related; this chapter also explores this relationship and shows how to exploit it. Pointers have been lumped with the goto statement as a marvelous way to create impossible-to-understand programs. This is certainly true when they are used carelessly, and it is easy to create pointers that point somewhere unexpected. With discipline, however, pointers can also be used to achieve clarity and simplicity. This is the aspect that we will try to illustrate. The main change in ANSI C is to make explicit the rules about how pointers can be manipulated, in effect mandating what good programmers already practice and good compilers already enforce. In addition, the type void * (pointer to void) replaces char * as the proper type for a generic pointer
|
|
Read more...
|
|
|
Data Types, Variables, and Constants |
|
|
|
|
Written by Hemanshu Patel
|
|
Friday, 19 October 2007 |
Data Types, Variables, and Constants C and C++ offer the programmer a rich assortment of built-in data types. Programmer-defined data types can be created to fit virtually any need. Variables can be created for any valid data type. Also, it is possible to specify constants of C/C++’s built-in types. In this section, various features relating to data types, variables, and constants are discussed.
|
|
Read more...
|
|
|
Written by Hemanshu
|
|
Wednesday, 17 October 2007 |
Operators in C The aim of this chapter is to cover the full range of diverse operators available in C. Operators dealing with pointers, arrays and structures will be left to late
|
|
Last Updated ( Friday, 19 October 2007 )
|
|
Read more...
|
|
|
|
<< Start < Prev 21 22 23 24 25 26 27 Next > End >>
|
| Results 287 - 299 of 342 |