The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to create dirs sjajimi Shell Programming and Scripting 2 07-24-2007 08:34 AM
needed very good link for Shell script rajareddy_24 Shell Programming and Scripting 1 05-10-2007 02:50 AM
create a shell script maykap100 Shell Programming and Scripting 3 08-31-2005 11:17 PM
Create Symbolic Link lesstjm UNIX for Dummies Questions & Answers 2 03-21-2005 03:36 PM
Shell script to create a DOS-like Menutiem bionicfysh Shell Programming and Scripting 2 06-17-2002 05:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2008
Shreedhar Naik's Avatar
Shreedhar Naik Shreedhar Naik is offline
Registered User
  
 

Join Date: May 2008
Posts: 12
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 (permalink)  
Old 05-22-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,770
cd to the directory where the link will live. Use the ln command there. cd - to return to the original directory.
  #3 (permalink)  
Old 05-22-2008
nua7 nua7 is offline
Registered User
  
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 353
Thumbs up

Please check this link...

Examples of using the ln command
  #4 (permalink)  
Old 05-22-2008
Shreedhar Naik's Avatar
Shreedhar Naik Shreedhar Naik is offline
Registered User
  
 

Join Date: May 2008
Posts: 12
Thumbs up

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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0