Location of the user’s home directory

$HOME contains the path of the current user’s home directory. It’s used in tilde expansion.

Examples

Output the path to the current user’s home directory.
1
echo "$HOME"
Tilde expansion for the current user
1
echo ~
Tilde expansion for another user
1
echo ~jane

Output the path to the home directory of user “jane”. If the user does not exist, then the output depends on your shell’s implementation.

BashSupport Pro 是一个 支持 $HOME 的 Bash 集成开发工具 – 马上试用!
© 2020–2022 Joachim Ansorg
声明
隐私政策
许可条款