Basic HTML version of Foils prepared Sept 20 97

Foil 71 Execution of UNIX Commands -- backquotes

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


1 $now= "Todays date: " . `date`; # sets $now to be the specified label followed by the result of shell's date command
2 `who` would naturally return a set of lines and the result can be stored in an array -- one array entry for each output line
3 Both system and backquote mechanism invoke a shell command which normally share standard input, standard output and standard error with the Perl program
4 This can be reset as for instance in
5 `rm fred 2>&1`; # using shell syntax to send standard error to same place as standard output

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Sep 21 1997