I wrote following Go code.
package main
import (
"fmt"
"os"
"strings"
)
func main() {
fmt.Println(os.Args)
}
Then compiled it...
$ go build -o out
And created following script a.sh
:
#! /bin/bash
set -eu
./out "--opt1" "$@"
Then run a.sh
and the result is:
$ a.sh hoge --foo bar
[./out --opt1 hoge --foo bar ]
I want to get $@
as string. I expected [./out --opt1 "hoge --foo bar" ]
as a result.
However they are splitted to array elements (by whitespace or $IFS
?).
Is there any idea to get $@
?