Yep, I think you're right. Thanks,
There's a number of other things wrong with /etc/profile.
I posted some "
observations" a long time ago, but most of them are still unaddressed.
On my install, I stripped all the prompt setting code out into a profile.d/prompt.sh:
Code:
#!/bin/false # /etc/profile.d/prompt.sh ############################
#
# Set an appropriate shell prompt string for the invoking shell:
#
# Notes:
#
# o $SHELL is not a reliable way of identifying the specific
# shell implementation that is invoking /etc/profile.
# $0 is a little more reliable, except that zsh treats it
# differently to everything else when it's sourcing files. :(
# Therefore, we have to use ${ZSH_ARGZERO:-$0} to cater for
# zsh.
#
# o DO NOT EXPORT PS1!
# Any use of shell specific syntax in the prompt string will
# result in a messed up prompt when using nested invocations of
# other shell implementations. Besides, 'bash' has a tendency to
# unset the variable when used non-interactively, so, the chances
# are that it'll just be lost somewhere down the environment
# inheritance chain anyway.
#
# o /etc/profile is not invoked by non-login shells, so users
# wuuld do better to set their desired prompt in their shell
# specific startup files, such as ~/.bashrc.
#
# Traditional UNIX shells that are 'interactive' will always
# source their startup file (pointed to by $ENV) regardless of
# whether they are 'login-shells' or not, but bash does not do
# this unless invoked as 'sh'. A workaround for this is
# to source ~/.bashrc from your ~/.bash_profile.
#
case $- in
*i*) # interactive shell
case "${ZSH_ARGZERO:-$0}" in # zsh shenanigans!
-bash|bash|*/bash ) PS1='\u@\h:\w\$ ' ;;
-ksh|ksh|*/ksh ) PS1='! ${PWD/#$HOME/\~}$ ' ;;
-pdksh|pdksh|*/pdksh ) PS1='! $ ' ;;
-zsh|zsh|*/zsh ) PS1='%n@%m:%~%# ' ;;
*) PS1="$ " ;;
esac
;;
esac
########################################################################
(including your fix for ksh
)