Re: [OT] Need some bash scripting assistance

2010-06-10 Thread James Wellnitz
Something like this will basically do the "increment target link" part (making some big assumptions, doing no error checking, not handling wrap-around, etc.): cur_link=$(readlink target | sed -e "s#./##") cur_number=${cur_link%% *} cur_number=${cur_number#0} let new_number=cur_number+1 new_number=

Re: [OT] Need some bash scripting assistance

2010-06-10 Thread Dale J. Chatham
Just to nail the point home, if you have spaces in the name, you must put quotes around the name of the variable containing the name. Or: FILE="a b c.txt" cat "$FILE" cat "a b c.txt" If it has things like "?", "*", or others, Danger Will Robinson!! On 06/10/2010 11:14 AM, Roberto Ragusa wro

Re: [OT] Need some bash scripting assistance

2010-06-10 Thread Roberto Ragusa
Marko Vojinovic wrote: > Hi folks! :-) > > This is the story: I have a directory full of files named as: > > 01 Some file > 02 Some other file > 03 & yet another file > 04 etc... > > There is also a symbolic link called "target" pointing to one of them. > The numbers at the beginning of file nam

Re: [OT] Need some bash scripting assistance

2010-06-10 Thread Phil Meyer
On 06/10/2010 08:32 AM, Marko Vojinovic wrote: > Hi folks! :-) > > This is the story: I have a directory full of files named as: > > 01 Some file > 02 Some other file > 03& yet another file > 04 etc... > > There is also a symbolic link called "target" pointing to one of them. > The numbers at the