[英]ZSH does not load my prezto profile with “sudo -s”
I've install prezto as usual from my home directory and configured my favorite prompt (bigfade). 我像往常一样从主目录安装了prezto,并配置了我最喜欢的提示符(bigfade)。
It works when I login with my current user account. 当我使用当前用户帐户登录时,它可以工作。
But when I make sudo -s
to become root, my profile is not loaded as in other systems. 但是,当我使
sudo -s
成为root时,不会像在其他系统中那样加载我的配置文件。 I look everywhere and didn't see anything, my /etc/zsh/zshrc
file is configured fine as you can see attached. 我到处都看不到,什么也没看到,我的
/etc/zsh/zshrc
文件配置良好,如附件所示。
The attached picture show how my shell behaves 所附图片显示了我的外壳的行为
And the txt file is my /etc/zsh/zshrc
file txt文件是我的
/etc/zsh/zshrc
文件
# /etc/zsh/zshrc: system-wide .zshrc file for zsh(1).
#
# This file is sourced only for interactive shells. It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#
# Global Order: zshenv, zprofile, zshrc, zlogin
READNULLCMD=${PAGER:-/usr/bin/pager}
# An array to note missing features to ease diagnosis in case of problems.
typeset -ga debian_missing_features
if [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] &&
[[ "$TERM" != 'emacs' ]]
then
typeset -A key
key=(
BackSpace "${terminfo[kbs]}"
Home "${terminfo[khome]}"
End "${terminfo[kend]}"
Insert "${terminfo[kich1]}"
Delete "${terminfo[kdch1]}"
Up "${terminfo[kcuu1]}"
Down "${terminfo[kcud1]}"
Left "${terminfo[kcub1]}"
Right "${terminfo[kcuf1]}"
PageUp "${terminfo[kpp]}"
PageDown "${terminfo[knp]}"
)
function bind2maps () {
local i sequence widget
local -a maps
while [[ "$1" != "--" ]]; do
maps+=( "$1" )
shift
done
shift
sequence="${key[$1]}"
widget="$2"
[[ -z "$sequence" ]] && return 1
for i in "${maps[@]}"; do
bindkey -M "$i" "$sequence" "$widget"
done
}
bind2maps emacs -- BackSpace backward-delete-char
bind2maps viins -- BackSpace vi-backward-delete-char
bind2maps vicmd -- BackSpace vi-backward-char
bind2maps emacs -- Home beginning-of-line
bind2maps viins vicmd -- Home vi-beginning-of-line
bind2maps emacs -- End end-of-line
bind2maps viins vicmd -- End vi-end-of-line
bind2maps emacs viins -- Insert overwrite-mode
bind2maps vicmd -- Insert vi-insert
bind2maps emacs -- Delete delete-char
bind2maps viins vicmd -- Delete vi-delete-char
bind2maps emacs viins vicmd -- Up up-line-or-history
bind2maps emacs viins vicmd -- Down down-line-or-history
bind2maps emacs -- Left backward-char
bind2maps viins vicmd -- Left vi-backward-char
bind2maps emacs -- Right forward-char
bind2maps viins vicmd -- Right vi-forward-char
# Make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init () {
emulate -L zsh
printf '%s' ${terminfo[smkx]}
}
function zle-line-finish () {
emulate -L zsh
printf '%s' ${terminfo[rmkx]}
}
zle -N zle-line-init
zle -N zle-line-finish
else
for i in {s,r}mkx; do
(( ${+terminfo[$i]} )) || debian_missing_features+=($i)
done
unset i
fi
unfunction bind2maps
fi # [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] && [[ "$TERM" != 'emacs' ]]
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \
/usr/local/bin \
/usr/sbin \
/usr/bin \
/sbin \
/bin \
/usr/X11R6/bin
(( ${+aliases[run-help]} )) && unalias run-help
autoload -Uz run-help
if [[ -z "$skip_global_compinit" ]]; then
autoload -U compinit
compinit
fi
export PATH=$PATH:/opt/terraform
I'm using debian jessie on this only system, the others with wheezy and Ubuntu work. 我在这个唯一的系统上使用debian jessie,其他使用wheezy和Ubuntu的系统。
Apparently you need to install Prezto to root user's home dir if you want to use it there. 显然,如果您要在根用户的主目录中使用Prezto,请先将其安装。 A root shell won't load runcoms from
SUDO_USER
's home. 根外壳程序不会从
SUDO_USER
的主目录加载runcoms。 – 4ae1e1 – 4ae1e1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.