1

I'm testing alacritty and it has a config where you provide the absolute path to the program and the args for the shell to run. Which would ordinarily either be /bin/bash -l or /bin/zsh -l.

The thing is that i'd like to keep my configuration the same, but some of my machines I run bash and some I run zsh. So, I'd like to use the standard program which delegates the selection of the user's shell.

Normally this seems to be /usr/bin/login, but when I specify this program, it actually prompts me for user and password, which is far from ideal.

As far as I can tell, iTerm2 does somehow use login but in a way that doesn't prompt for credentials. I wonder how I could set this up.

Actually upon some quick searching, we find that iterm actually implements its own shell launcher because of limitations seen with Apple's login. Interesting.

Steven Lu
  • 39,229
  • 55
  • 195
  • 348

1 Answers1

2

You can get an absolute path to the current user's login shell by parsing /etc/passwd:

getent passwd $LOGNAME | cut -d ':' -f 7

You could potentially place a subshell in the config which will evaluate to the real path:

$(getent passwd $LOGNAME | cut -d ':' -f 7)

John Moon
  • 894
  • 9
  • 10
  • I don't think the config works like this or supports execution of shell commands. It is nice to learn about getent. Although it does not exist on macOS. – Steven Lu Nov 21 '17 at 15:13
  • BusyBox doesn't have getent so you may try `grep ^$(id -un): /etc/passwd | cut -d : -f 7-` from this answer https://stackoverflow.com/a/16375660/1049542 – Sergey Ponomarev Nov 20 '20 at 06:54