A question about using a bash script to start a game

Associate
Joined
28 Oct 2002
Posts
1,510
Hi

I have installed Hearts of Iron 2 Doomsday/Armageddon with the TRP mod in Ubuntu. None of the shortcuts that it set up (or i try and create) work.

However, if i open a terminal and cd to the game directory and then run the program through wine then it works fine

my knowledge if linux and shell scripts is very limited but i wondered if i could set up a script to run the game. So i set up the following file on my desktop:

trp.sh

which has in it:
#!/bin/bash
cd /home
cd /diss
cd /.wine
cd /drive_c
cd /TRP
cd /Doomsday
wine Hoi2.exe

However this doesn't work either as when i run it nothing happens.

Any idea how i can get this to work?

many thanks

Diss
 
What are you trying to achieve with those 'cd' commands? What is the full path to your game executable?

cd /Doomsday refers to a top level directory because of the leading /

If you want to go down a directory level, you would type :

Code:
cd Doomsday




As for the script, you have to make it executable:

Code:
chmod 755 trp.sh
 
Last edited:
Script looks wrong to me maybe try

#!/bin/bash
/insert/full/path/to/wine Hoi2.exe

Instead of using all those cd commands
Don't forget to make it executable. Just keep trying..
 
Script looks wrong to me maybe try

#!/bin/bash
/insert/full/path/to/wine Hoi2.exe

Instead of using all those cd commands
Don't forget to make it executable. Just keep trying..

That would only work if the script was in the game directory, and he shouldn't need the full path to wine,

I'd do:

#!/bin/bash
wine /home/diss/.wine/drive_c/TRP/Doomsday/Hoi2.exe


That should execute Hoi2.exe wherever the script is run (eg placed on your desktop...) (might need to chmod as exor mentioned)

Shell Scripts are simply just a collection of command line commands, the ones you gave would fail after the first cd as you will be trying to do "cd /diss" which i'm assuming doesn't exist and you meant "cd /home/diss..." hence why the script is failing :)
 
thanks guys - much appreciated

well, your advice worked, sort of but not quite - though this may be a problem with the game

it runs the correct program through wine but i get a critical error in a wine window saying:
--- excel file not found - do you want to continue?

the game still runs fine if i run it from the terminal

any ideas whats going on here?

many thanks

diss
 
terminal info was:
fixme:spoolsv:serv_main (0 (nil))
fixme:ntdll:RtlNtStatusToDosErrorNoTeb no mapping for 8000000a
err:alsa:ALSA_CheckSetVolume Could not find 'PCM Playback Volume' element
fixme:mixer:ALSA_MixerInit No master control found on MPU-401 UART, disabling mixer
fixme:mixer:ALSA_MixerInit No master control found on Brooktree Bt878, disabling mixer
 
hmmm
the script does work if i put it in the Doomsday folder

is this some sort of 'path' problem?
and if so how do i fix?

thanks again

diss
 
i tried the path command but it didn't seem to change anything

diss@linux:~$ echo $PATH
/home/diss/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
diss@linux:~$ path=$path:/home/diss/.wine/drive_c/TRP/Doomsday
diss@linux:~$ echo $PATH
/home/diss/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
diss@linux:~$ path=$path:/home/diss/.wine/drive_c/TRP/Doomsday
diss@linux:~$ export path
diss@linux:~$ echo $PATH
/home/diss/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
diss@linux:~$

what am i doing wrong?

is there a gui to do this?

thanks

diss
 
hmmm
the script does work if i put it in the Doomsday folder

is this some sort of 'path' problem?
and if so how do i fix?

thanks again

diss

Leave the script in the Doomsday folder and run it from there? You can create a shortcut on the desktop that points to the script in the Doomsday folder.
 
thanks
will give it a try - sounds like that should work

would still like to know how to edit PATH if anyone can help

thanks

Diss
 
Code:
#!/bin/bash
cd /home/diss/.wine/drive_c/TRP/Doomsday
wine Hoi2.exe

wine should then run from the game directory, rather than... probably your home directory. I have a feeling that is what is tripping it up.
 
thanks
will give it a try - sounds like that should work

would still like to know how to edit PATH if anyone can help

thanks

Diss

You seem to be getting the case mixed up, so you are setting/altering the "path" variable when you want to be altering the "PATH" variable

So the command you would use to add the Doomsday directory to the PATH would be:

PATH=$PATH:/home/diss/.wine/drive_c/TRP/Doomsday

Or just modify the script to be like markiemrboo said :p
 
Back
Top Bottom