日期:2014-05-16  浏览次数:20547 次

linux shell之波浪号扩展

在linux shell下面,~和当前user的home目录是等效的,
在linux shell下,波浪号总是被自动扩展成当前user的home目录。
sh-# echo $HOME
/
sh-# mkdir /my_home
sh-# export HOME=/my_home/
sh-# echo $HOME
/my_home/
sh-# cd ~
sh-# pwd
/my_home
sh-# cd /
sh-# ls ~
sh-# touch /my_home/test_file
sh-# ls ~
test_file

待解决问题:
user的home目录是如何预设的?

2楼boyxulin19865天前 19:29
自己必须顶自己
1楼boyxulin19865天前 19:28
以后凡是没明白的问题都以待解决问题明确的标注出来,等找到答案后再补上去。