Need to check links exists in the server based on that need to run the build script

Hi,
I am working on a build script which will check for the links existing in the server ,then run the gen command to start the build process.

Appreciate help on this.
server os:sun solaris 10.Bash shell

links present in the server location /spa/5.0:

genver -> sa0_genver_release
genlibs -> sa0_genlibs
scripts -> /spa/common/5.0/scripts
filetran -> /spa/common/5.0/filetran
data -> /spa/common/5.0/data

My Aim here is to automate the build script.What is does is first it will search for the links present in the /spa/5.0 directory are proper or not.For example:genver -> sa0_genver_release .This was the actual link should present in the server.
1)Script has to check whether mentioned link exists or not .if not exist ,it should throw a error mess and should create the link.(likewise for all the links)
2)Scritpt has to prompt the message like this
Do you want to create makefile or Do you want to create makefile&build
in case if user selects create makefile option then it has to run the gen -c command
if user selects create makefile&build option it has to run the gen clean all command.

I hope i have mentioned required information.Appreciate your help on this.
Advance thanks for the response.

---------- Post updated at 08:50 AM ---------- Previous update was at 04:37 AM ----------

Any help on this?

---------- Post updated 04-25-12 at 02:26 AM ---------- Previous update was 04-24-12 at 08:50 AM ----------

I have tried following command to find out the links are exist or not.

ls -lrt|grep machdefs.pl |grep ^l
lrwxrwxrwx   1 spal     spastaff      11 Apr 10 16:59 AUX_MACHINE_DEFINITION -> machdefs.pl

anyother way of checking it in solaris 10 bash shell?

---------- Post updated 04-26-12 at 02:03 AM ---------- Previous update was 04-25-12 at 02:26 AM ----------

I have tried with readlink() but now luck.it does not exit.

Appreciate any help on it?

Thread closed, continue here: