On 10/18/2010 02:10 AM, Zico wrote:
On Mon, Oct 18, 2010 at 2:10 AM, Siddhesh Poyarekar<
[email protected]> wrote:
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
Thank you again. But, if I call the variable as "n", the whole name of the
file becomes *n. *
Do a `man bash` or `info bash` and search for `Parameter Expansion`. Quick ref:
[st...@laptop ~]$ i="foo.txt"
[st...@laptop ~]$ echo $i ${i%%.txt} ${i/txt/mp3}
foo.txt foo foo.mp3
hth,
cheers,
- steve
--
random spiel: http://lonetwin.net/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc