Eval101 » Historique » Version 5
François Rioult, 22/06/2010 22:30
| 1 | 1 | François Rioult | h1. Eval101 |
|---|---|---|---|
| 2 | |||
| 3 | h2. Synopsis |
||
| 4 | |||
| 5 | This operator has only one parameter and no input. The corresponding shell script executes the parameter as a command, and copies the result in the output. |
||
| 6 | |||
| 7 | h2. Parameters |
||
| 8 | |||
| 9 | 4 | François Rioult | 1 parameter, treated as the command to be executed. The command can contains spaces, such as @ls -al@, @date -R@. |
| 10 | 1 | François Rioult | |
| 11 | h2. Inputs |
||
| 12 | |||
| 13 | No input |
||
| 14 | |||
| 15 | h2. Outputs |
||
| 16 | |||
| 17 | 1 output: the result of the command |
||
| 18 | |||
| 19 | 5 | François Rioult | h2. Shell code |
| 20 | |||
| 21 | <pre> |
||
| 22 | cmd=$1; shift |
||
| 23 | output=$1; shift |
||
| 24 | |||
| 25 | $cmd > $output |
||
| 26 | </pre> |
||
| 27 | |||
| 28 | 1 | François Rioult | h2. Example |
| 29 | |||
| 30 | 2 | François Rioult | This operator can be used for generating a file, containing the current date for example, with "date" as a parameter. |
| 31 | 3 | François Rioult | |
| 32 | See the scenario [[missing.aws]], where this operator initiates an "empty" file with only the date for a "for" loop. |