Unix/Linux Go Back    


Slackware The Official Release of Slackware Linux by Patrick Volkerding is an advanced Linux operating system, designed with the twin goals of ease of use and stability as top priorities.

Context dependent symlinks

Slackware


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-21-2011
agentrnge agentrnge is offline
Registered User
 
Join Date: Jan 2009
Last Activity: 10 October 2016, 11:24 AM EDT
Location: New Jersey, USA
Posts: 21
Thanks: 4
Thanked 4 Times in 3 Posts
Context dependent symlinks

Ive got multiple PCs, sharing an NFS mounted home dir. For certain apps I would like to keep the config files host specific. Easy solution is to create symlinks to local folders for configs. Ideally I would still want the .config files to reside in the user home folder.

Is it possible to create a symlink with a variable in its name that where the variable is expanded when the link is traversed, rather than when the link is created.

So far my searching has resulted only in some oracle cluster specific solutions. My hosts involved are running a mix of Slackware 12 and 13 x64.

Thanks
Sponsored Links
    #2  
Old Unix and Linux 05-24-2011
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 20 January 2017, 5:46 PM EST
Location: Saskatchewan
Posts: 21,780
Thanks: 1,027
Thanked 4,038 Times in 3,746 Posts
Quote:
Originally Posted by agentrnge View Post
Ive got multiple PCs, sharing an NFS mounted home dir. For certain apps I would like to keep the config files host specific. Easy solution is to create symlinks to local folders for configs. Ideally I would still want the .config files to reside in the user home folder.

Is it possible to create a symlink with a variable in its name that where the variable is expanded when the link is traversed, rather than when the link is created.
Very simple answer to that I'm afraid: No. A symlink is not dynamic like that in any way.

Why not just handle the dir in /etc/profile? That's what it's there for.

Code:
if [ -f /path/${to}/file ] 
then
        source /path/${to}/file
else
        source /etc/genericfile
fi

The Following User Says Thank You to Corona688 For This Useful Post:
agentrnge (05-30-2011)
Sponsored Links
    #3  
Old Unix and Linux 05-24-2011
pludi's Unix or Linux Image
pludi pludi is offline Forum Advisor  
Cat herder
 
Join Date: Dec 2008
Last Activity: 28 March 2014, 8:35 AM EDT
Location: Vienna, Austria, Earth
Posts: 5,521
Thanks: 38
Thanked 335 Times in 308 Posts
Context dependent symlinks require the support of either the kernel, or the filesystem kernel module. On Linux, as far as I know, only OCFS offers that support.
The Following User Says Thank You to pludi For This Useful Post:
agentrnge (05-30-2011)
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
tar symlinks: relative vs absolute TreeMan UNIX for Dummies Questions & Answers 2 08-21-2009 02:41 PM
Symlinks ct1977 UNIX for Dummies Questions & Answers 1 02-21-2008 06:15 PM
Nested Symlinks? deckard Shell Programming and Scripting 0 09-07-2007 04:07 PM
Job dependent on other job pankajkrmishra Shell Programming and Scripting 4 09-11-2006 03:26 AM



All times are GMT -4. The time now is 04:33 AM.