3

When I try to redirect stdout and stderr output of a command onto a file. There is nothing which gets written into a file. This is in a Perl script. I want the stdout and stderr output of a command to be redirected to a file. The code I wrote is this:

system("sudo rm a.txt &>> output.txt");

The file output.txt doesn't contain anything at all. Can someone help me with this?

Biffen
  • 5,791
  • 5
  • 29
  • 34
Daylite
  • 489
  • 1
  • 5
  • 18

1 Answers1

2
system("sudo rm a.txt >> output.txt 2>&1")
cppcoder
  • 20,990
  • 6
  • 49
  • 78