On Mon, Oct 18, 2010 at 1:26 AM, Zico <[email protected]> wrote:
> Thanks a lot! Now, Say, there are five files... 1 2 3 4 & 5. Now, I want to
> rename and replace the new inserted sixth file as 1, seventh file as 2 ...
> and so on. What should be my script command? By the way, there will be no
> more than "five" modified files there!!
>

You're basically looking to replace the oldest file at all times,
kinda like log rotation, so you can simply follow the logic:

n=$(ls -1|wc -l)
lf n < 5 then
   create the n+1th file
else
   replace the file you get with ls -1t|tail -1
end if

-- 
Siddhesh Poyarekar
http://siddhesh.in
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to