LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-13-2012, 08:06 PM   #1
croog
LQ Newbie
 
Registered: Feb 2006
Distribution: fedora-17-x86_64 Xfce
Posts: 29

Rep: Reputation: 1
Can I make a symbolic link that is dynamic link->$HOME/file?


I have a pre-compiled game (Dwarf Fortress) that keeps all of its saves in a specific folder which I cannot change the location of. I want to replace it with a link that points a folder in a user's home directory depending on who is logged in so that one user will not be able to access any other user's saved games.

I have tried using the ln command with no luck. It seems that links are only static.
I tried the commands
Code:
ln -s $HOME/save save
ln -s '$HOME/save' save
The first resolves to the current user's home directory and breaks if another user is logged in. In the second the link created was broken. I think it was looking for a folder named $HOME not the system variable.

If you know how to achieve this or even where I might start looking for a solution please let me know.

btw if you like games with a ton of depth and don't mind little-no graphics check out Dwarf Fortress
 
Old 10-13-2012, 10:47 PM   #2
descendant_command
Member
 
Registered: Mar 2012
Posts: 758

Rep: Reputation: 159Reputation: 159
Make a wrapper script that creates the link first then starts the game.
 
1 members found this post helpful.
Old 10-14-2012, 12:16 AM   #3
croog
LQ Newbie
 
Registered: Feb 2006
Distribution: fedora-17-x86_64 Xfce
Posts: 29

Original Poster
Rep: Reputation: 1
That was so easy I feel stupid for not thinking of it myself. Here is my script if anyone is interested.

Code:
#! /bin/bash
rm -v /home/.bin/df_linux/data/save
if [ ! -d ~/.df/save ]
then
    mkdir -pv ~/.df/save
fi
ln -sv ~/.df/save /home/.bin/df_linux/data
/home/.bin/df_linux/df
 
Old 10-14-2012, 11:04 AM   #4
suicidaleggroll
Senior Member
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 2,670

Rep: Reputation: 956Reputation: 956Reputation: 956Reputation: 956Reputation: 956Reputation: 956Reputation: 956Reputation: 956
This is a good approach if only one person will be running the game at once.
 
Old 10-14-2012, 07:55 PM   #5
croog
LQ Newbie
 
Registered: Feb 2006
Distribution: fedora-17-x86_64 Xfce
Posts: 29

Original Poster
Rep: Reputation: 1
For me that is the case, multiple simultaneous logins are disabled on this machine, so I consider it solved. Though, I would think a more universal solution is better.
 
  


Reply

Tags
dynamic, symbolic link


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make a symbolic link ? chrislabricole Red Hat 5 01-29-2009 06:44 AM
How to create symbolic link to html file and avoid page link problem? haxpor Linux - General 2 01-29-2008 07:40 AM
cannot make symbolic link dave`2005 Debian 3 10-08-2005 10:15 AM
Is it possible to make a dir a symbolic link? dr_zayus69 Linux - General 4 03-09-2005 08:48 AM
How to make symbolic link? Tommi Linux - General 9 05-07-2003 08:58 AM


All times are GMT -5. The time now is 02:40 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration