tags:

views:

151

answers:

2

I have a script to check if any data is available on svn repo path but not added into svn. It works fine for me but this gives stderr for adding and sending files like below;

Adding         1/a
Sending        1/a
Transmitting file data ...........
Committed revision 529.

Code:

use strict;
use warnings;

sub notAdded {
        my @svnstatus = `svn st`;
        foreach my $status (@svnstatus) {
                chomp($status);
                if ($status =~ m/^?/) {
                        my ($symble, $left) = split(' ', $status);
                        system("svn add $left");
                }
        }
}

&notAdded();
system("svn commit -m 'comment'");

Can anyone please suggest me how can I redirect this error to /dev/null within the script.

+4  A: 

The normal way to hide unwanted output with SVN is to use the -q (quiet) flag:

svn -q add nothere

displays nothing.

anon
A: 

Or the really easy way:

system("svn add $left 2>/dev/null");
Jeremy Wall
Why the downvotes? My suggestion works for any command you run using system whether it's svn or something else.
Jeremy Wall