This question already has an answer here:
I want to run the following bash command using golang's exec.Command()
ls > sample.txt
For this I write
_,err:=exec.Command("ls",">","sample.txt").Output()
But this doesn't seem to work. I know I can write to a file by using
exec.Command().StdoutPipe()
But I want to write sepcifically in that manner. Any idea how I can do it in golang?
</div>