bash基本知识
时间:2006-08-19 来源:sosogh
Command |
New working directory |
---|---|
cd book |
/home/cam/book |
cd book/wonderland |
/home/cam/book/wonderland |
cd ~/book/wonderland |
/home/cam/book/wonderland |
cd /usr/lib |
/usr/lib |
cd .. |
/home |
cd ../gryphon |
/home/gryphon |
cd ~gryphon |
/home/gryphon |
Table 1-2. Basic wildcards
Wildcard |
Matches |
---|---|
? |
Any single character |
* |
Any string of characters |
[set] |
Any character in set |
[!set] |
Any character not in set 这个还可以表示成[^set],但是 [!set]不能用在grep或者sed的regex中,因为在grep等的regex中[!set]中的!是一个“表面字符”,而不是一个“特殊字符”
|
Table 1-3. Using the * wildcard
Expression |
Yields |
---|---|
fr* |
frank fred |
*ed |
ed fred |
b* |
bob |
*e* |
darlene dave ed fred |
*r* |
darlene frank fred |
* |
bob darlene dave ed frank fred |
d*e |
darlene dave |
g* |
g*(当*号匹配不当任何东西时候,shell会直接把g*这2个字符送到cmd中去) |