What happens if the user enters the string "'; rm -fr ~;'" ? On Monday, 19 September 2022 at 13:25:31 UTC+1 Brian Candler wrote:
> On Monday, 19 September 2022 at 10:50:36 UTC+1 princ...@gmail.com wrote: > >> >> *search:=scanner.Text()cmd1,err:=exec.Command("bash", "-c", "find . -name >> '*$search*'")* > > > You first "search" is a go local variable. > Your second "$search" is seen by the shell as a reference to an > environment variable. > > So if you want to do it that way, you need to set it in the environment, > e.g. with os.Setenv. > https://pkg.go.dev/os#Setenv > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/e2aafbd7-3f67-4170-aee1-489cf8c26540n%40googlegroups.com.