[OT] Need some bash scripting assistance

Marko Vojinovic vvmarko at gmail.com
Thu Jun 10 14:32:00 UTC 2010

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 names are there so that there is
some specific ordering of files. What I need is a bash script that
will determine the name of the file that goes after the one target
points to, and relink the target to point to that one instead.

So if target points to "02 Some other file", after executing the
script it should point to "03 & yet another file". When the target
reaches the end it should restart from the beginning. Files typically
have spaces and other escapable characters that should be properly
taken care of.

Can anyone point me into the easiest way of doing this?

What I am actually doing is more complicated, but this step is where I
am a bit clueless... :-)

Thanks! :-)

More information about the users mailing list