注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

骐骥一跃

日积跬步 业精于勤荒于嬉

 
 
 

日志

 
 

[原创]FreeBSD学习笔记03-默认搜索路径  

2008-06-12 14:53:22|  分类: Unix/Linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

( 声明:原创文章,未经授权,不得转载。作者:印第安 http://blog.kysf.net

 

 

Default Search Path

 

When you type a command at the command prompt, FreeBSD looks in a list of directories for the name of the command you entered and runs the program if a match is found. This list of directories is called the default search path or path environment variable.

The order in which FreeBSD searches this path is important when installing third-party software, which this book concentrates on. Most third-party program files are put into subdirectories of /usr/local. The default position of the /usr/local directory is near the end of the path statement. If a command that is part of a third-party application has the same name as a command that is part of the base FreeBSD command set, it will never run because the FreeBSD command will be found first and always take precedence. Since we'll be installing third-party applications to extend and/or update FreeBSD's base system, it is beneficial to invert the order of the search path. Let's change the order of the default search path for the root user using Easy Editor:

# cd /root  # ee .cshrc


We'll comment out (disable) the default set path statement and enter our own customized one. Scroll down to the set path) to disable it, then add the alternative path below so that your third-party programs will run even if they have the same names as native FreeBSD commands. The set path statement should now appear as follows:

#set path = (/sbin /bin /usr/sbin /usr/bin /usr/games   /usr/local/sbin /usr/local/bin /usr/X11R6/bin)    set path = (/usr/local/sbin /usr/local/bin /usr/sbin   /usr/bin /sbin /bin $HOME/bin)



Note: The text is wrapped above but each set path statement should only occupy a single line in the .cshrc file.


Save, exit, log out, and log in. You can display the current search path with this command:

# echo $path


By default, non-root users use the sh shell (interface), and root defaults to the tcsh shell. The default search path can be modified for non-root users in the same way. The sh shell stores this setting in the .profile file of each user's home directory.

 

 

( 声明:原创文章,未经授权,不得转载。作者:印第安 http://blog.kysf.net

  评论这张
 
阅读(887)| 评论(0)
推荐

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018