Siduction Forum > Scripting & Kernelhacking

[EN] [SOLVED] Flexible User

(1/1)

tosidornottosid:
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!

absolut:
can we not use "~/.wine" for  WINEPREFIX ?

OppaErich:
or /home/$USER/.wine

tosidornottosid:
Yes. It worked.
Thank you both!

Navigation

[0] Message Index

Go to full version
Powered by Advanced Topic Prefix Pro
Powered by SMFPacks WYSIWYG Editor