zsh -d -f -i
is correct for that, though -d
(implied by -f
) and -i
(zsh
runs interactively anyway when not given any script/code to run on the command line and stdin is a terminal) would be redundant.
Note however that /etc/zsh/zshenv
is still interpreted and I don't think there's any way to disabled that. See info zsh RCS
for details.
In your case, PS1
was inherited from the environment. PS1
is one of many environment variables that can also customize the shell.
Note that earliest shells had no rc file, customisation was done with environment variables only (which you'd set in the ~/.profile
or ~/.login
, interpreted by the login shell).
There are a large numbers of variables used to configure the shell. See:
info zsh 'Parameters Used By The Shell'
for details (note though that for some of them, the value found in the environment is ignored).
Some of those environment variables, like HOME
, PATH
, SHELL
, COLUMNS
, LANG
, LC_*
are used by many other programs than the shell, so it's not a good idea to unset them, or to use env -i
to unset them all.
Most of those variables listed in that documentation you would not want to put in the environment, but declare them in your ~/.zshrc
instead as normal shell variables. PS1
is one of them. PS1
is used as the prompt customisation variable in many shells, but the syntax varies greatly between shell.
Unfortunately, some GNU/Linux distributions do set and export the PS1
variable in some system start-up file, and define it with a value specific to the syntax of the bash
shell (the GNU shell), which means that if you start any shell other than bash
in an environment with that PS1
, you get a garbage prompt.
To start a shell with PS1
removed from the environment, you can do:
(unset -v PS1; zsh -f)
With some env
implementations, you can also do:
env -u PS1 zsh -f
To start it with no environment variable (though as noted above, it's probably not a good idea):
env -i zsh -f
typeset +x PS1
. Or start it asenv - FOO=bar zsh
.