du with backticksby Panasonictoilet (Initiate)
|on Mar 20, 2008 at 00:21 UTC||Need Help??|
Panasonictoilet has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow monks,
I am trying to write a script that goes through home directories and does a du but excludes stuff in specific Maildir directories, cur, new, tmp and courierimapkeywords. I have tested it on the commandline and I have it in my perl script as below:
$du=`du -ch $homedir | grep -v '^.*Maildir.*cur$' | grep -v '^.*Maildir.*tmp$' | grep -v '^.*Maildir.*new$' | grep -v '^.*Maildir.*courierimapkeywords$'`; print $du;
However this does not work and is giving me the following errors:
du: cannot access `~skim': No such file or directory sh: .*Maildir.*tmp: not found sh: .*Maildir.*courierimapkeywords: not found
I have used backticks before for simple operations but is this too complicated for backticks, or do i need to escape certain character out, if so how??
Please help enlighten me fellow monks!