File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -145,9 +145,21 @@ func main() {
145145 }
146146 welcomeMessage = strings .ReplaceAll (welcomeMessage , "\\ " , "\\ \\ " )
147147
148- preferredShells := "bash zsh sh"
148+ shells := []string {
149+ "bash" ,
150+ "zsh" ,
151+ "sh" ,
152+ }
153+ var shellDetectionCommands []string
154+ for _ , shell := range shells {
155+ shellDetectionCommands = append (shellDetectionCommands , "command -v " + shell )
156+ }
157+ for _ , shell := range shells {
158+ shellDetectionCommands = append (shellDetectionCommands , "which " + shell )
159+ }
160+
149161 var cmdPrintWelcome = fmt .Sprintf ("echo '%s'" , color .YellowString (welcomeMessage ))
150- var cmdLaunchShell = fmt .Sprintf ("$(command -pv %[1]s | head -n1 || which %[1]s | head -n1)" , preferredShells )
162+ var cmdLaunchShell = fmt .Sprintf ("$(%s)" , strings . Join ( shellDetectionCommands , " || " ) )
151163
152164 runOptions .Environment = append (runOptions .Environment , "PS1=" + ps1 )
153165 runOptions .Entrypoint = []string {"/bin/sh" }
You can’t perform that action at this time.
0 commit comments