|
发表于 2006-10-12 19:51:56
|
显示全部楼层
- for d in `ls`;do
- if [ -d $d ]
- then
- a.sh $d
- fi
- done
复制代码 之所以不用awk print $9是因为移植性的问题,在我的机器里,ls -l出来的列数并不一致
drwxr-xr-x 2 root root 4096 7月 27 15:00 bin
drwxr-xr-x 3 root root 4096 7月 24 09:59 boot
drwxr-xr-x 9 root root 4880 10月 12 08:58 dev
drwxr-xr-x 120 root root 12288 10月 12 08:57 etc
drwxr-xr-x 8 root root 4096 9月 13 22:11 home
drwxr-xr-x 12 root root 4096 8月 21 09:29 lib
drwx------ 2 root root 16384 6月 8 20:13 lost+found
drwxr-xr-x 3 root root 4096 6月 8 17:30 media
drwxr-xr-x 2 root root 4096 2005-04-25 misc
drwxr-xr-x 3 root root 4096 8月 17 17:38 mnt
drwxr-xr-x 2 root root 4096 2005-05-23 opt
dr-xr-xr-x 89 root root 0 10月 12 16:57 proc
drwxr-x--- 45 root root 4096 10月 12 17:00 root
drwxr-xr-x 2 root root 12288 6月 9 04:52 sbin
drwxr-xr-x 2 root root 4096 6月 8 12:16 selinux
drwxr-xr-x 2 root root 4096 2005-05-23 srv
drwxr-xr-x 10 root root 0 10月 12 16:57 sys
drwxr-xr-x 3 root root 4096 6月 8 14:32 tftpboot
drwxrwxrwt 44 root root 4096 10月 12 19:15 tmp
drwxr-xr-x 15 root root 4096 7月 10 15:08 usr
drwxr-xr-x 27 root root 4096 6月 8 14:23 var
可以看到,有的是9列,有的是7列。 |
|