The lines removed cause the shell to be identified as `fish` if the `__fish_bin_dir`, even when `$SHELL` is explicitly set to something else. This causes a fish user to get the `fish` env when running a non-fish sub-shell. All bash scripts that use `docker-machine env` will fail for fish users. Signed-off-by: Scott M. Smith <scottsmith1@gmail.com>
27 lines
471 B
Go
27 lines
471 B
Go
// +build !windows
|
|
|
|
package shell
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
var (
|
|
ErrUnknownShell = errors.New("Error: Unknown shell")
|
|
)
|
|
|
|
// Detect detects user's current shell.
|
|
func Detect() (string, error) {
|
|
shell := os.Getenv("SHELL")
|
|
|
|
if shell == "" {
|
|
fmt.Printf("The default lines below are for a sh/bash shell, you can specify the shell you're using, with the --shell flag.\n\n")
|
|
return "", ErrUnknownShell
|
|
}
|
|
|
|
return filepath.Base(shell), nil
|
|
}
|