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
  • 6,249
  • 6
  • 28
  • 36
Daylite
  • 499
  • 1
  • 7
  • 19

1 Answers1

2
system("sudo rm a.txt >> output.txt 2>&1")
cppcoder
  • 22,227
  • 6
  • 56
  • 81