You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
344 B

6 years ago
package main
import (
"flag"
"fmt"
"os"
s "strings"
)
var noNewline = flag.Bool("n", false, "Do not print the terminating newline.")
func echo(strings []string, noNewline bool) {
str := s.Join(strings, " ")
if noNewline {
fmt.Print(str)
} else {
fmt.Println(str)
}
}
func main() {
flag.Parse()
echo(os.Args[1:], *noNewline)
}