I've been playing around changing the default login shell of my user using a combination of /etc/shells
and chsh
.
This was needed, as I wanted to change from the default shell (/bin/zsh
) to /opt/homebrew/bin/zsh
, and the latter was compiled for arm64.
This worked fine until I accidentally deleted Brew's zsh
, which resulted in the terminal being unable to run shells, until I configured a custom command (e.g. /bin/zsh
). This allowed me to reinstall Brew's zsh
, but what surprised me was that $SHELL
expanded to /opt/homebrew/bin/zsh
, despite actually running /bin/zsh
.
Now, since I can't really rely on $SHELL
, I attempted to lookup the actual shell using ps -Af
, but that doesn't show the full path?
➜ ~ ps -Af | grep -ie zsh
502 12860 12856 0 2:08PM ttys000 0:00.94 -zsh
502 16303 12860 0 2:09PM ttys000 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox -ie zsh
502 11291 11290 0 2:06PM ttys002 0:00.82 -zsh
ps -fp$PPID
, or, if$PPID
is not defined by your mutant shell, get the parent process's PID fromps -fp$$
. – waltinator Jul 18 '23 at 16:37login
command, not the shell – Shuzheng Jul 18 '23 at 16:51ps
process.ps -fp $$
is correct here. – Sotto Voce Jul 18 '23 at 23:14