Shell script to create a link


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to create a link
# 1  
Old 05-22-2008
Shell script to create a link

Hi All,

I have a problem to writing a shell script to create a soft link in some other directory

For eg:

/opt/Shreedhar/Naik is directory
now i need to write shell script in the path /opt/Shreedhar/Naik which should create a soft link in /opt/Shreedhar.

I have tried to write the script by using the command: ln -s ivperl /opt/Shreedhar/perl/5.6.1 but its creating the link in the same folder. But i need to create the link in on-step back folder ie: /opt/Shreedhar my script location is /opt/Shreedhar/Naik
# 2  
Old 05-22-2008
cd to the directory where the link will live. Use the ln command there. cd - to return to the original directory.
# 3  
Old 05-22-2008
MySQL

Please check this link...

Examples of using the ln command
# 4  
Old 05-22-2008
MySQL

Thanks

I have used like

ln -s /opt/Shreedhar/perldist/5.6.2 /opt/Shreedhar/ivperl

And It's working...

But i need to create this link only when the link is not exists in /opt/Shreedhar if the link is already exists the script should not create the link and even should not give any error message. Is there any way to check whether the link is exists or not. Like -e for file check ....

Last edited by Shreedhar Naik; 05-22-2008 at 08:23 AM.. Reason: added new query
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

2. UNIX for Advanced & Expert Users

Open a webbrowser link from shell script

Hi All I have a task which is manually submitted from a web browser link, by entering a value. This has an xml code as well. I am looking for options to automate the above to avoid manual intervention/dependency. Is there a way I can achieve this using shell script? Either open the link by... (3 Replies)
Discussion started by: sparks
3 Replies

3. UNIX for Advanced & Expert Users

Cannot create a link with the same name

Hi - Our system admin cannot create a link to NAS with one particular name but he can create with other names. What might be the cause? Regards ---------- Post updated at 11:30 AM ---------- Previous update was at 11:29 AM ---------- It says permission denied. (2 Replies)
Discussion started by: w020637
2 Replies

4. Solaris

Create a Link for a directory

Hi, I need to create a link as stagein01 for the /p11/prod/stagein01/. Please let me know the procedure for the same. Regards, VN (5 Replies)
Discussion started by: narayanv
5 Replies

5. Shell Programming and Scripting

how to remove the target of the symbol link in a shell script

I have a target directory, there are some files and directories in "target_dir". I have a symbol link: my_link -> <target_dir> The target directory name is NOT known to the script (because it is varying), while the link name is always fixed. In a shell script, how to remove both the... (1 Reply)
Discussion started by: princelinux
1 Replies

6. Shell Programming and Scripting

SED - Create mailto: link

Help! I am using sed to convert text files into easily viewed html tables. I have managed all except converting the email addresses to mailto: links. Multiple email addresses exist within the files, either preceded by a space or > (as part of HTML tag), and followed by either space or < I've... (5 Replies)
Discussion started by: Nigel_R
5 Replies

7. Shell Programming and Scripting

How can I execute a shell script from an html link?

I want to execute a shell script when clicking on an html link. I want the output of the script to be shown on the webpage. Whats the best way to achieve this? (6 Replies)
Discussion started by: streetfighter2
6 Replies

8. Shell Programming and Scripting

Shell script -- symbolic link

Hi , pwd -P will give the physical directory name for symbolic names. is there any command to get the value of symbolic link ? if it's symbolic link , I have to get the physical directory name? any ideas to code in shell ? Thanks (3 Replies)
Discussion started by: talashil
3 Replies

9. Shell Programming and Scripting

needed very good link for Shell script

I am new to shell script.I need a link which explains basic concepts for shell scrpting (1 Reply)
Discussion started by: rajareddy_24
1 Replies

10. UNIX for Dummies Questions & Answers

Create Symbolic Link

I am Solaris korn shell. I want to create a symbolic link. I have a directory /u01/ftp01/db I want to reference it as /u05/swe/my (this is not a real directory) I tried a symbolic link but it does not work ln -s /u01/ftp01/db /u05/swe/my ln: cannot create //u05/swe/my: No such... (2 Replies)
Discussion started by: lesstjm
2 Replies
Login or Register to Ask a Question