LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 652|回复: 2

一个奇怪的目录问题

[复制链接]
发表于 2005-9-3 08:09:51 | 显示全部楼层 |阅读模式
前几天,我不小心,发现用户home目录下面有一个叫做~的子目录。我初步怀疑是wget生成了这个目录。因为它的下载内容保存在~/下面,但是为什么没有直接保存在/home/robin/下面呢?(用户名为robin),而是在/home/robin/~下面。
这样的结果是,我在terminal里,用cd ~ 来进入这个目录,结果还是在/home/robin,因为用户的home目录,刚好也是叫~.
困惑啊,后来只好用mv ~ jj,来试图将这个目录的名字改掉,结果不行,
[robin@localhost ~]$ mv ~ /home/robin/
mv: 无法将目录‘/home/robin’移动至本身的子目录‘/home/robin/robin’下
[robin@localhost ~]$
再后来,我用
mv "~" /home/robin

这次成功了。里边的下载的文件也找到了。
哪个高手解释一下好吗?
发表于 2005-9-3 09:01:06 | 显示全部楼层
The ~, when quoted with "", i.e. "~", your system will identify it as a character, not your home directory.  For the same reason, you can use a "*' or even "..." as the name of a directory, despite it is not recommended.

Sometimes, people may try to use this trick to confuse others.  However, it is often confused themselves.
回复 支持 反对

使用道具 举报

发表于 2005-9-3 09:40:33 | 显示全部楼层
hoho, funny it is
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表