I'm writing a ksh script which will reference a text file I have to create symbolic links for my application:
--file contents--
Link Directory Link Source Link Name
/users/05/dwisconbug bin link2bin
Now, this should create the following link
link2bin -> /users/05/dwisconbug/bin
Before the script creates the symbolic link "link2bin" it needs to see if the link already exists - I know with brute force i can just delete the current link and recreate it, but I want to make sure the current link is pointing to the right source.
How do I use ksh/Unix commands to:
1) "ls -l link2bin" and awk(?) to grab the "link2bin-> /users/05/dwisconbug/bin"
2) If I set the contents of my file to the variables $link_dir, $link_src, and $link_nm generate what I expect the link to look like
3) somehow diff the results from steps #1 and steps #2 to make sure the existing link matches what I have listed in my file?
Any ideas? Thanks in advance!
PS: as you can imagine I need to get this working by the end of the day - so any help is appreciated!