如何删除shell的搜索路径?
-
- 帖子: 13
- 注册时间: 2009-06-24 11:29
如何删除shell的搜索路径?
新手的问题。
今天看教程可以用 export PATH=~/bin:$PATH 命令来增加shell的搜索路径。
那我想删除其中一个搜索路径,应该怎么做呢?
今天看教程可以用 export PATH=~/bin:$PATH 命令来增加shell的搜索路径。
那我想删除其中一个搜索路径,应该怎么做呢?
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
-
- 帖子: 13
- 注册时间: 2009-06-24 11:29
Re: 如何删除shell的搜索路径?
列举?能详细说明一下吗?
- HuntXu
- 帖子: 5776
- 注册时间: 2007-09-29 3:09
-
- 帖子: 13
- 注册时间: 2009-06-24 11:29
Re: 如何删除shell的搜索路径?
理解了楼上的意思,
比如,现在的$PATH值为:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
当我想删除/usr/games路径时,可以通过:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
来实现。
可是现在我知道$PATH值为:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
如何删除/usr/games呢?
大家帮忙写个完整的示例出来,谢了!
比如,现在的$PATH值为:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
当我想删除/usr/games路径时,可以通过:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
来实现。
可是现在我知道$PATH值为:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
如何删除/usr/games呢?
大家帮忙写个完整的示例出来,谢了!
- chenfengyuan的马甲
- 帖子: 25
- 注册时间: 2009-07-06 7:57
Re: 如何删除shell的搜索路径?
${parameter#word}mecho 写了:理解了楼上的意思,
比如,现在的$PATH值为:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
当我想删除/usr/games路径时,可以通过:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
来实现。
可是现在我知道$PATH值为:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
如何删除/usr/games呢?
大家帮忙写个完整的示例出来,谢了!
${parameter##word}
The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches the beginning of the value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ``#'' case) or the longest matching pattern (the ``##'' case) deleted. If parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with @ or *, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.
${parameter%word}
${parameter%%word}
The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches a trailing portion of the expanded value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ``%'' case) or the longest matching pattern (the ``%%'' case) deleted. If parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with @ or *, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.
${parameter/pattern/string}
${parameter//pattern/string}
The pattern is expanded to produce a pattern just as in pathname expansion. Parameter is expanded and the longest match of pattern against its value is replaced with string. In the first form, only the first match is replaced. The second form causes all matches of pattern to be replaced with string. If pattern begins with #, it must match at the beginning of the expanded value of parameter. If pattern begins with %, it must match at the end of the expanded value of parameter. If string is null, matches of pattern are deleted and the / following pattern may be omitted. If parameter is @ or *, the substitution operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with @ or *, the substitution operation is applied to each member of the array in turn, and the expansion is the resultant list.
- chenfengyuan的马甲
- 帖子: 25
- 注册时间: 2009-07-06 7:57
Re: 如何删除shell的搜索路径?
manpage里有
-
- 帖子: 13
- 注册时间: 2009-06-24 11:29
Re: 如何删除shell的搜索路径?
回6楼: 那是些啥东西?
回7楼:manpage是什么?是不是论坛上面的wiki?
回7楼:manpage是什么?是不是论坛上面的wiki?
- BigSnake.NET
- 帖子: 12522
- 注册时间: 2006-07-02 11:16
- 来自: 廣州
- 联系:
Re: 如何删除shell的搜索路径?
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
^_^ ~~~
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
- chenfengyuan的马甲
- 帖子: 25
- 注册时间: 2009-07-06 7:57
Re: 如何删除shell的搜索路径?
export PATH=${PATH%:/usr/games} #没试过,看man照着写的。不过,不建议你删除,还是直接export PATH=.....比较好,因为我不知道什么好的方法,那个不安全。可能回把类似于/usr/games/lib(如果有的话)的改成/lib。mecho 写了:回6楼: 那是些啥东西?
回7楼:manpage是什么?是不是论坛上面的wiki?
在终端里man bash