solaris simple bash script -


i'm trying execute simple script in solaris. want sort(numeric) filenames of files in source directory , copy file 1 one directory. and, want print message after copying every 100 files.

#!/bin/bash  count=0  in `ls | sort -n`   cp $i ../target  count = $((count+1))  if[ $count%100 -eq 0 ]       echo $count files copied     sleep 1  fi  done 

this not working. tried different things after searching in net.
errors these -

syntax error @ line 8: '(' unexpected.
syntax error @ line 10: 'then' unexpected.
syntax error @ line 13: 'fi' unexpected etc.

what problem script?

bash version - gnu bash, version 3.00.16(1)-release (sparc-sun-solaris2.10)

count=$((count+1))

if [ `echo $count % 100 | bc` -eq 0 ] 

make these corrections.

edit: please try

count=`expr $count + 1` 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -