The Execution OperatorHere's a cool onethe execution operator lets you run operating system commands and programs. All you've got to do is to enclose the command you want to run in backticks (`not the same as a single quote!). Here's an example that runs the date system command, captures the output, and displays it:
Here's the kind of result you might see under Unix, using the bash shell:
Because date is also a command in DOS, here's what you might see in a DOS window:
What if you want to pass an argument to the system command? Include the argument in the backticks too, as in the following, where we're executing the command dir c:\temp in Windows:
The result appears in Figure 2-4. Figure 2-4. Executing system commands.[View full size image] |
Wednesday, October 28, 2009
The Execution Operator
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment