cd ..
带有控制结构的shell程序(文件名为ex2)。
$ cat ex2
#!/bin/bash
# If no arguments, then listing the current directory.
# Otherwise, listing each subdirectory.
if test $# = 0
then ls .
else
for i
do
ls -l $i | grep '^d'
done
fi
4.5.4 注释、管道线和后台命令
1.注释
#!/bin/bash
# If no arguments, then listing the current directory.
# Otherwise, listing each subdirectory.
2.管道线
ls -l $HOME | wc –l
ls | grep m?.c | wc –l
3.后台命令
$ gcc m1.c&