Please send questions to
st10@humboldt.edu .
#!/usr/bin/perl -w
#######################################################
# lect07_system_misc
#
# discussion of some process-related miscellany,
# including some points related to the system comman
#
# modified by Sharon Tuttle from "Learning Perl",
# by Schartz and Phoenix
#
# last modified: 10-5-04
#######################################################
my @dirs = qw(fred|flintstone <barney&rubble> betty );
foreach (@dirs)
{
chomp;
print "#$_#\n";
}
# consider :
# my $tarfile = "blah.tar";
#
# what's the difference between:
#
# system "tar cvf $tarfile @dirs";
# system "tar", "cvf", $tarfile, @dirs;
#
# in system "tar cvf $tarfile @dirs";
# saying:
# tar cvf blah.tar fred|flintstone <barney&rubble> betty
# ...OR --- pipe results to a program named fred,
# which'll be run in the background,
# redirecting results to a file betty... !
# system "tar", "cvf", $tarfile, @dirs;
# saying: pass a command tar the arguments cvf,
# then whatever is in $tarfile,
# then whatever is in @dirs
# ...but they go to the tar command, not to the general shell;
# multi-arg system also a good way to call another shell:
# system "/bin/tcsh", $command_desired;
#-----------------------------------------------------------
# system command's return value is based on exit status
# of the returned child --- if 0, that's usually good!
# !system blah or die "something went wrong";
# end of lect07_system_misc