diff --git a/eval.go b/eval.go index 6108296f..6be01b8d 100644 --- a/eval.go +++ b/eval.go @@ -377,6 +377,8 @@ func (e *setExpr) eval(app *app, _ []string) { return } gOpts.shellopts = strings.Split(e.val, ":") + case "shelldash", "noshelldash", "shelldash!": + err = applyBoolOpt(&gOpts.shelldash, e) case "sizeunits": switch e.val { case "binary", "decimal": diff --git a/opts.go b/opts.go index f9df1de8..730ec017 100644 --- a/opts.go +++ b/opts.go @@ -101,6 +101,7 @@ var gOpts struct { shell string shellflag string shellopts []string + shelldash bool showbinds bool sizeunits string smartcase bool @@ -264,6 +265,7 @@ func init() { gOpts.shell = gDefaultShell gOpts.shellflag = gDefaultShellFlag gOpts.shellopts = nil + gOpts.shelldash = true gOpts.showbinds = true gOpts.sizeunits = "binary" gOpts.smartcase = true diff --git a/os.go b/os.go index 0d39e633..c26c087f 100644 --- a/os.go +++ b/os.go @@ -138,7 +138,11 @@ func shellCommand(s string, args []string) *exec.Cmd { s = fmt.Sprintf("IFS='%s'; %s", gOpts.ifs, s) } - args = append([]string{gOpts.shellflag, s, "--"}, args...) + if gOpts.shelldash { + args = append([]string{gOpts.shellflag, s, "--"}, args...) + } else { + args = append([]string{gOpts.shellflag, s}, args...) + } args = append(gOpts.shellopts, args...)