Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Create login shell with coder sh #224

Merged
merged 1 commit into from
Jan 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/cmd/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ func shell(cmd *cobra.Command, cmdArgs []string) error {
args = append(args, strings.Join(cmdArgs[1:], " "))
} else {
// Bring user into shell if no command is specified.
args = append(args, "exec $(getent passwd $(whoami) | awk -F: '{ print $7 }')")
shell := "$(getent passwd $(id -u) | cut -d: -f 7)"
name := "-$(basename " + shell + ")"
args = append(args, fmt.Sprintf("exec -a %q %q", name, shell))
}

envName := cmdArgs[0]
Expand Down