Files
docker-machine/libmachine/shell/shell.go
Scott f26dda16f6 Remove hard-coded incorrect "fish" shell identification.
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>
2016-09-20 09:40:07 -07:00

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
}