Siduction Forum

Siduction Forum => Scripting & Kernelhacking => Topic started by: tosidornottosid on 2013/10/14, 09:08:35

Title: [SOLVED] Flexible User
Post by: tosidornottosid on 2013/10/14, 09:08:35
Good Day to All!

Let us say that we have a standalone Windows program and we want to run it with a script. Suppose we are User 1 and we "exist" in /home/user1

We create our script, e.g.

#!/bin/sh

cd `dirname "$0"`

env WINEPREFIX="/home/user1/.wine" wine program.exe

It works. But there is no flexibility in the user path. That is, if we install the system again or to another computer and we deside to change the username to John Smith, we have to edit the script accordingly:

#!/bin/sh

cd `dirname "$0"`

env WINEPREFIX="/home/johnsmith/.wine" wine program.exe

One can observe that the command cd `dirname "$0"`
is very "flexible": there is no need to type a specific directory path. The folder containing the standalone program can be put anywhere.

Is there a way to achieve similar flexibility with the user name, so one does not need to edid the script every time the username changes?

Thanks!
Title: RE: Flexible User
Post by: absolut on 2013/10/14, 11:44:16
can we not use "~/.wine" for  WINEPREFIX ?
Title: RE: Flexible User
Post by: OppaErich on 2013/10/14, 11:51:04
or /home/$USER/.wine
Title: RE: Flexible User
Post by: tosidornottosid on 2013/10/15, 07:55:13
Yes. It worked.
Thank you both!