">" is a special character interpreted by your shell.

On Sun, Nov 12, 2017 at 8:35 PM,  <buc...@gmail.com> wrote:
> package main
>
> import(
> "fmt"
> "os/exec"
> )
>
> func main ()
> cmd := exec.Command("ls", ">", "/dev/null")
> output, err := cmd.CombinedOutput()
> if err != nil {
> fmt.Println(fmt.Sprint(err) + ": " + string(output))
> }
>
>
> When I run this go program I get:
> exit status: 1: ls: >:No such file or directory
> /dev/null
>
> When I do this from the (bash/sh) shell command line:
> |# ls > /dev/null
> it works correctly (no errors and exit status: 0
>
>
> I've stared at this code for several days now and am getting nowhere.  Any
> thoughts?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to