Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
背景故事:我通过 SSH 连接到想要查看个性化 root 提示的服务器。但是,其他人登录这些服务器并不一定要我更改提示。
问题:如何创建一个 zsh 别名/函数,以便我可以作为普通用户登录,然后键入[my su shortcut]将启动一个 su 会话,从我的个人主目录获取 .zshrc,并让我处于 root 提示符下?
[my su shortcut]
alias mysu="su -c \"ZDOTDIR=$HOME zsh\""
有关详细信息,请参阅zsh(1)。