1 [[email protected] ~]# cat x.sh 2 #!/bin/bash 3 4 fun_x () { 5 6 du -h $1 |tail -1 7 8 } 9 10 for i in `ls $1` 11 do 12 fun_x $1$i 13 done 14 [[email protected] ~]# sh x.sh /usr/ 15 132M /usr/bin 16 4.0K /usr/etc 17 4.0K /usr/games 18 34M /usr/include 19 325M /usr/lib 20 447M /usr/lib64 21 34M /usr/libexec 22 6.1G /usr/local 23 28M /usr/sbin 24 1.1G /usr/share 25 48M /usr/src 26 0 /usr/tmp 27 [[email protected] ~]#
时间: 2024-10-03 23:55:16