Naghaveer R
Naghaveer R

Reputation: 2944

How to re-direct output to same file always?

I trying to redirect output to same text file. But I'm not able to do. please help me

code

foreach my $config (sort keys %{$details}) {
  if (exists $details->{$config}) {
    foreach my $project (sort keys %{ $details->{$config} }) {
      system( "$path/perl ./bin/export_from_ddts.pl 2> \"\'>>\' ./logs/system_error.txt\"" );
      system( "$path/perl ./bin/convert_to_csv.pl  2> \"\'>>\' ./logs/system_error.txt\"" );
    }
  }
}

Upvotes: 0

Views: 53

Answers (2)

Naghaveer R
Naghaveer R

Reputation: 2944

system(qq($path/perl ./bin/export_from_ddts.pl 2>>./logs/system_error.txt));

Upvotes: 2

Borodin
Borodin

Reputation: 126722

You should print the string you are passing to system. As it stands you are using

/path/to/perl ./bin/export_from_ddts.pl 2> "'>>' ./logs/system_error.txt"

which is clearly nonsense.

Upvotes: 0

Related Questions