$ grep a[[:blank:]] words2.txt #匹配字母a后面有着空格的行
Is this a dagger which I see before me,
A dagger of the mind, a false creation,
Moves like a ghost. Thou sure and firm-set earth,
$
$ grep Th.[[:space:]] words2.txt #匹配 Th ,然后再匹配一个任意字符(.),接着匹配空格
The handle toward my hand? Come, let me clutch thee.
The curtain’d sleep; witchcraft celebrates
Thy very stones prate of my whereabout,
$
$ grep -E [a-z]\{10\} words2.txt #匹配连续有 10 个小写字母的行
proceeding from the heat-oppressed brain?
And such an instrument I was to use.
The curtain’d sleep; witchcraft celebrates
Thy very stones prate of my whereabout,
$
#!/bin/sh
echo The current directory is $PWD #PWD 是环境变量
echo The current users are $(who) #执行了 who 命令
exit 0
#!/bin/sh
x=0
while [ "$x" -ne 10 ]; do
echo $x
x=$(($x+1))
done
exit 0
#!/bin/sh
for i in 1 2
do
echo $i_tmp
done
[beyes@localhost shell]$ sh parameters_expansion.sh
1_tmp
2_tmp
#!/bin/sh
unset foo
echo ${foo:-bar}
foo=fud
echo ${foo:-bar}
foo=/usr/bin/X11/startx
echo ${foo#*/}
echo ${foo##*/}
bar=/usr/local/etc/local/networks
echo ${bar%local*}
echo ${bar%%local*}
exit 0
[beyes@localhost shell]$ sh parameter_process.sh
bar
fud
usr/bin/X11/startx
startx
/usr/local/etc/
/usr/
cjpeg image.gif > image.jpg
#!/bin/sh
for image in *.gif
do
cjpeg $image > ${image%%gif}jpg
done
#!/bin/sh
cat << !FUNKY!
hello
this is a here
document
!FUNKY!
[beyes@localhost here_document_dir]$ sh here_document.sh
hello
this is a here
document
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |