shell.sh
#!/bin/bash
npx create-react-app <project-name> --template typescript
run.go
func runScript(genErr *error) {
if *genErr != nil {
return
}
cmd := exec.Command("/bin/sh", "-c", shell)
*genErr = cmd.Run()
}
details.go
type npmLibCommand struct {
ProjectName string
}
var npmLib npmLibCommand
func getNpmLibraryInput(genErr *error) {
if *genErr != nil {
return
}
npmLib.ProjectName = GetProjectName(genErr)
}
I want to pass projectName
variable from run.go
to shell.sh
. How to do this using golang?
I used $
in shell.sh
. It didn't work.
a.sh
main.go