login-shell 1 user commands nosh
login-shell invoke a shell as a login shell
`login-shell`

## Description

`login-shell` takes the value of the `SHELL` environment variable, defaulting to the operating system's default shell name if it is not present or blank, and chain-loads to it. It prepends a minus sign to the 0th argument that it passes to the shell, the Unix convention for telling a shell that it is a login shell. The `SHELL` environment variable can be set up with the userenv-fromenv 1 utility, amongst others.

This is effectively identical to using exec 1 with its -a command-line option:

    $ command exec -a -"${SHELL}" "${SHELL}"

Because `login-shell` is a built-in command, it saves a round-trip executing an entire external sh 1 utility in service bundle run scripts, simply to do some trivial argument processing.

## History

Paul Jarc created a loginshell utility for idtools in 2001. It also permitted passing arguments to the shell, which of course usually tells a shell that it is non-interactive, which is inappropriate for `login-shell`'s limited and specific purpose of starting a login shell.

## Author

Jonathan de Boyne Pollard