<code interpreter="/bin/bash">
#!/bin/bash
ctr0=0;
for F in *.ifd; do
if $ctr0 = 0 ] ; then
let ctr0=$ctr0+1 ;
echo $F;
else ctr0=0;
fi
done
</code>
Good luck.
NhatPhongTran wrote:
> Hi!
>
> I want to create a bash script which should do something to every nth
> file in a directory, i.e. copy. The script I got so far looks like
> this:
>
>> #! /bin/sh
>>
>> for F in *.ifd
>> do
>> echo copying: $F
>> done
>
> But now it just copies every file. Now I want it to copy only every 2nd
> file for example. What would the approach be for that?
>
> Kind regards,
>
>
> Phong
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/