I was editing a shell script and I want to know how can use for to use all directories listed by a list or variables and then execute a command.
Example:
I have this directories:
/dirname1/app1
/dirname1/app2
/dirname2/app1
/dirname2/app2
The thing is each directory have 8 application directory, and I need to get the value of each one using du for usage of each one.
I have this example piece of code that I made, but I want to convert it more better than the actually have.
#!/bin/ksh
#files="/dev /etc"
inc=1
for f in /*;
do
vari=`du -ksh $f`
[ -d $f ]
echo "The value of each one is: ------ : $((inc++)): $vari"
done;
echo "Execution Done."
exit 0
I hope to be cleared with this,