| 1 | // Package shell returns the current user's shell across multiple platforms. |
| 2 | package shell |
| 3 | |
| 4 | import ( |
| 5 | "runtime" |
| 6 | ) |
| 7 | |
| 8 | // DefaultShell returns the default shell depending on runtime.GOOS. |
| 9 | func DefaultShell() string { |
| 10 | switch runtime.GOOS { |
| 11 | case "darwin": |
| 12 | return "/bin/zsh" |
| 13 | case "openbsd": |
| 14 | return "/bin/ksh" |
| 15 | case "plan9": |
| 16 | return "/bin/rc" |
| 17 | case "windows": |
| 18 | return "powershell.exe" |
| 19 | default: |
| 20 | return "/bin/sh" |
| 21 | } |
| 22 | } |