Basic HTML version of Foils prepared March 30 97

Foil 77 Execution of UNIX Commands -- backquotes (Chapter 15 of Llama Book)

From PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 -- February 1995. by Geoffrey C. Fox


1 $now= "Todays date: " . `date`; # sets $now to be the specified label followed by result of shell's date invocation
2 `who` would naturally return a set of lines and the result can be stored into 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 Sat Sep 6 1997