I need to accept command line argument to run a Go program in the below format:
go run app.go 1->A
I am using os.Args[1]
. But it only accepts till '1-' . '>A' is being skipped.
Any help to resolve this issue is highly appreciated.
Thanks
I need to accept command line argument to run a Go program in the below format:
go run app.go 1->A
I am using os.Args[1]
. But it only accepts till '1-' . '>A' is being skipped.
Any help to resolve this issue is highly appreciated.
Thanks
Your shell is interpreting the >
as IO redirection. The shell opened the file A
as standard output for the command and passed the argument 1-
to the command.
Quote the argument to avoid this:
go run app.go "1->A"