VOGONS


First post, by RobertX

User metadata
Rank Newbie
Rank
Newbie

In a GNU/Linux distro, I am interested in storing a variable that contains the current /home/ directory.

In that past, I would have to ask the user to input the Home directory of the user in question.

I want the procedure to be automated.

This was how I did it:

# Ask for user name
STRINGS user = ASK Please enter your user name:

#Mount User drive
mount c /home/%user%/.dosbox/

So, how can I just mount the directory by itself? Does GNU/Linux store the home directory by itself, or do I have to stick with asking for the Home directory every time?

EDIT: I think I have to explain why I mount the user directory every time I start up DOSBox. Simply, I do it because that's where I store the programs/games in, nowhere else. I like my stuff structured and organised.

Reply 1 of 4, by Ringding

User metadata
Rank Member
Rank
Member

Just use the -c command line switch! This is what I do: <path-to>/dosbox -c "mount c ~/temp/dosbox"

Reply 2 of 4, by wierd_w

User metadata
Rank Oldbie
Rank
Oldbie

If this is not something that changes based on who has logged in, (eg, only one user, and the home dir is always the same dir), why not just add the line in dosbox.conf?

If this changes based on who is logged in, then a bash script that uses variables, and the -c invocation as shown above, is the better way. You can pass a command line argument or system variable in with the right decoration.

Reply 3 of 4, by zirkoni

User metadata
Rank Member
Rank
Member

The current user is stored in the $USER variable so this should work:

dosbox -c "mount c /home/$USER/.dosbox"

Another option is to use the $HOME variable:

dosbox -c "mount c $HOME/.dosbox"

https://youtube.com/@zirkoni42

Reply 4 of 4, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

put this in your config file

mount c ~

or if you want that specific path

mount c ~/.dosbox

Water flows down the stream
How to ask questions the smart way!