develooper Front page | perl.beginners | Postings from December 2008

"df -mg" system() -> $variable

Thread Next
From:
David
Date:
December 1, 2008 19:18
Subject:
"df -mg" system() -> $variable
Thank you to all who helped me get a 6 digit date into perl. I 
certainly heed warnings about not using outside system calls in perl 
however, I have to make an outside call again.



#!/usr/bin/perl -w
use strict;

my $fileName = "081201 diskSpace.txt";
my $fileLoc = "/Users/mini/diskSpaceLog/$fileName";
system "(df -mg;) >$fileLoc &";



My problem is the last line. Output:
sh: -c: line 1: syntax error near unexpected token `diskSpace.txt'
sh: -c: line 1: `(df -mg;) >/Users/mini/diskSpaceLog/081201 diskSpace.txt &'


I made sure to follow the Learning Perl code. It's just not working for me.

-David



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About