免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1587 | 回复: 5
打印 上一主题 下一主题

关于PATH变量的疑问 [复制链接]

论坛徽章:
1
辰龙
日期:2014-05-22 11:38:58
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-13 13:28 |只看该作者 |倒序浏览
$PATH
Path to binaries, usually /usr/bin/, /usr/X11R6/bin/, /usr/local/bin, etc.
When given a command, the shell automatically does a hash table search on the directories listed in
the path for the executable. The path is stored in the environmental variable, $PATH, a list of
directories, separated by colons. Normally, the system stores the $PATH definition in
/etc/profile and/or ~/.bashrc (see Appendix G).
bash$ echo $PATH
/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/sbin:/usr/sbin
PATH=${PATH}:/opt/bin appends the /opt/bin directory to the current path. In a script, it
may be expedient to temporarily add a directory to the path in this way. When the script exits, this
restores the original $PATH (a child process, such as a script, may not change the environment of the
parent process, the shell).
The current "working directory", ./, is usually omitted from the $PATH as a security
measure.

这是ABS里关于PATH变量的解释。
其中提到
When given a command, the shell automatically does a hash table search on the directories listed in
the path for the executable.

这里的"hash table search"指的是什么?
还有
The current "working directory", ./, is usually omitted from the $PATH as a security
measure.

这句也没理解安全在哪?
请大家指点,谢谢。

论坛徽章:
0
2 [报告]
发表于 2012-03-13 14:46 |只看该作者
google

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
3 [报告]
发表于 2012-03-13 15:00 |只看该作者
这里的"hash table search"指的是什么?是用内存存放的表,避免多次去外存找同样的文件

如果别人在你的某个目录里放个文件ls,功能是自动播放东京热,你在这个目录下面ls就有可能被老板炒了或被老板娘包了,如果./不在PATH里就相对“安全”一点儿

论坛徽章:
1
辰龙
日期:2014-05-22 11:38:58
4 [报告]
发表于 2012-03-13 16:26 |只看该作者
回复 3# waker


    谢谢waker

论坛徽章:
3
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:51:162015年亚洲杯之阿曼
日期:2015-04-07 20:00:59
5 [报告]
发表于 2012-03-13 19:51 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
1
双子座
日期:2013-10-17 00:46:45
6 [报告]
发表于 2012-03-14 00:30 |只看该作者
回复 3# waker


    斑竹的知识真渊博啊~
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP