Home » Infrastructure » Unix » shell script
shell script [message #201820] Mon, 06 November 2006 22:18 Go to next message
kprakashrao
Messages: 1
Registered: November 2006
Location: bangalore
Junior Member

Hi,

I am trying to use for loop like
count=0
for file in *.*
do
count='expr count + 1'
done
echo count

But this scrip takes the . as a file even there no files in the directory it says one file is there ..

how can I over come this

Thanks in advance
prakash
Re: shell script [message #201969 is a reply to message #201820] Tue, 07 November 2006 11:12 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Note - code uses back tick ` not single quote '
i=0
for FILE in `ls *.*`
do
        echo "--> $FILE"
        ((i=i + 1))  
done
echo "$i files"
Previous Topic: java script to connect to postgres database
Next Topic: how can i run plsql pgm on unix
Goto Forum:
  


Current Time: Thu Dec 08 22:30:42 CST 2016

Total time taken to generate the page: 0.05604 seconds