Can't launch app through bash script

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
User avatar
malonn
Level 2
Level 2
Posts: 27
Joined: Tue Oct 05, 2021 12:10 pm

Can't launch app through bash script

Post by malonn »

I'm trying to launch an app through a bash script. It launches fine through the terminal, but not through a script. The commands are the exact same. The error when launching via the script is something about no NTLM support. I can't quite see the debug print because it closes too soon. I'm on Wine 7.2-devel. So far, everything else is fine.
User avatar
malonn
Level 2
Level 2
Posts: 27
Joined: Tue Oct 05, 2021 12:10 pm

Re: Can't launch app through bash script

Post by malonn »

Also, I can cd to the directory of the executable and the script, and run the script through the terminal and it launches. I noticed when I do that that the same debug output appears, then it goes to the prompt, then it continues and launches.
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: Can't launch app through bash script

Post by jkfloris »

Maybe we can help you if you post the bash script.
User avatar
malonn
Level 2
Level 2
Posts: 27
Joined: Tue Oct 05, 2021 12:10 pm

Re: Can't launch app through bash script

Post by malonn »

Here's the script. Simple and to the point.

Code: Select all

#!/usr/bin/bash

PATH="/home/mark/.local/share/lutris/runners/wine/wine-tkg-git-7.2.r316/bin"
cd "/home/mark/Oblivion/drive_c/The Elder Scrolls IV/Oblivion"
WINEPREFIX=$HOME/Oblivion $PATH/wine obse_loader.exe -editor -notimeout
Like I said, it looks like the system goes to the terminal prompt and the script ends. If I launch the app via the terminal directly, or the script via the terminal, it spans multiple command prompts. Odd, I think, but I'm a Linux noob.
I can launch the same app fine through Lutris, so this problem isn't a big deal. I'd just like to understand what the problem is for the future.
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: Can't launch app through bash script

Post by jkfloris »

The PATH variabele is already used by your operating system.
Use lower case for your own variables. Then you'll always be safe.
User avatar
malonn
Level 2
Level 2
Posts: 27
Joined: Tue Oct 05, 2021 12:10 pm

Re: Can't launch app through bash script

Post by malonn »

Thanks for the tip. I'll remember that (I hope) going forward. However, it didn't fix my issue.
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: Can't launch app through bash script

Post by jkfloris »

Are you still using Linux Mint 20.2? Then you may also change the shebang to:

Code: Select all

#!/bin/bash
User avatar
malonn
Level 2
Level 2
Posts: 27
Joined: Tue Oct 05, 2021 12:10 pm

Re: Can't launch app through bash script

Post by malonn »

I'm on Linux Mint MATE 20.3. /bin is a symbolic link that points to /usr/bin. I don't think that link is native to the OS anyway? I'm not going to try it. Won't make a difference. My script is good, not that I don't appreciate your help. It's something with Wine. For some reason, launching the script ends the terminal functions. If I call it directly from the terminal, it spans multiple input prompts. Calling it from a script, it ends at the first input prompt. It's a Wine thing, not my script. Old versions of Wine didn't do that. It could be my custom Wine version. I'm launching my app via a wine-tkg-git version with custom patches. Having said that, the old versions with custom patches were fine. I may take this inquiry to the GitHub page of wine-tkg-git. Thanks for your help.
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: Can't launch app through bash script

Post by jkfloris »

It could be my custom Wine version. I'm launching my app via a wine-tkg-git version with custom patches. Having said that, the old versions with custom patches were fine.
You could test this by installing wine(-staging) and modify your script.

Another solution may be not to use a bash script, but to create a .desktop file.
Something like

Code: Select all

[Desktop Entry]
Name=Oblivion
Type=Application
Exec=env WINEPREFIX="/home/mark/Oblivion/" /home/mark/.local/share/lutris/runners/wine/wine-tkg-git-7.2.r316/bin/wine start /home/mark/Oblivion/drive_c/The Elder Scrolls IV/Oblivion/obse_loader.exe -editor -notimeout
User avatar
malonn
Level 2
Level 2
Posts: 27
Joined: Tue Oct 05, 2021 12:10 pm

Re: Can't launch app through bash script

Post by malonn »

I have Wine from Wine-HQ installed because Lutris needs it. I'll test launching via plain Wine. I actually thought of that, just never went through with it (yet).

I don't really want a menu entry. If I can launch a .desktop file from any folder, I'd try that. Can you? Or do .desktop files have to be in either ~/.local/share/applications or /usr/share/applications?

In the end, it runs fine via Lutris. So, I'm still in business.
Locked