Thank you for the response. On Mon, Sep 19, 2022 at 8:26 PM Tamás Gulácsi <tgulacs...@gmail.com> wrote:
> No, please, no! > > Do NOT use bash with string interpolation if possible! > Call find directly: > *cmd, err := exec.Command("find", ".", "-name", search)* > princ...@gmail.com a következőt írta (2022. szeptember 19., hétfő, > 12:04:32 UTC+2): > >> then we don't need to add these commands >> >> >> >> *scanner := bufio.NewScanner(os.Stdin)fmt.Println("Enter the substring >> name")scanner.Scan()search:=scanner.Text()* >> right??? >> >> we only need to keep this one >> *cmd, err := exec.Command("bash", "-c", fmt.Sprintf("find . -name %s", >> search))* >> >> On Monday, September 19, 2022 at 3:31:12 PM UTC+5:30 Jan Mercl wrote: >> >>> On Mon, Sep 19, 2022 at 11:50 AM PK <princ...@gmail.com> wrote: >>> >>> > search:=scanner.Text() >>> > cmd1,err:=exec.Command("bash", "-c", "find . -name '*$search*'") >>> >>> Try something like this, not tested: >>> >>> cmd, err := exec.Command("bash", "-c", fmt.Sprintf("find . -name >>> %s", search)) >>> >>> -- > 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/fb987200-6678-443f-a0ab-884b5f77c324n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/fb987200-6678-443f-a0ab-884b5f77c324n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAEMj0xp0G6LDWAB%2BJu7%3DPUXhH3T-%3DRPAmTN%2B_zZGkWoY7sjOjA%40mail.gmail.com.