I'm now studying as junior student in VSB-TUO university in Czech Republic. My teacher give me some tasks about sh programming. he always ask about : to access file, del sime string in this...or access system like count sum of files and count how many files in this address... or talk this people use which output or input device ...
Anyone have tutorials of this ? Could you help me. I would like to have some example of ps, sed, ls, ...
I have one task : create procedure, which find in this adress (and also in its subdirectory) how many files and how big (count sum files) in this adress.
He had done this but I write bad. it's doesn't run. Could you help me to repair it : here it is
#!/bin/bash
adr=${*-`pwd'}
for i in $adr
do
if test -d $i
then
poc=0
vel=0
for j in `ls -l $i | sed 1d |sed '/ */s// /g' | cut -d"" -f5c
do
poc=`expr $poc +1`
vel=`expr $vel + $j`
done
echo "In this adress $i have $poc files and sum of size is $vel"
fi
done
exit 0
I think some thing wrong in "for j in ...." and I don't understand this : ls -l $i |sed 1d |sed'/ */s// /g' |cut -d"" -f5c
Thanks you very much