You are not logged in.

#1 2022-12-31 02:17:07

PFleur
Member
Registered: 2022-12-31
Posts: 23

[SOLVED] running wine in a Bourne shell script using a variable

I'm trying to batch convert files with a windows program through wine, when using the loop:

for i in $files; do
  `wine frm2bmp.exe $i`
done

it returns a series of errors stating: "./batchfrm2bmp.sh: line 12: $'\r': command not found" followed by the value of $i at that point in the loop. How would/can I fix this?

Last edited by PFleur (2022-12-31 02:46:52)

Offline

#2 2022-12-31 02:32:27

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,259

Re: [SOLVED] running wine in a Bourne shell script using a variable

How exactly are you filling $files ? That reads like a escape sequence for \r makes it's way into the command which leads to it trying to run it as a distinct command rather than an argument to pass to the exe. If you're parsing ls don't parse ls use *.fmp or whatever directly as part of the loop

Last edited by V1del (2022-12-31 02:34:45)

Offline

#3 2022-12-31 02:33:56

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] running wine in a Bourne shell script using a variable

Please post the contents of the entire script.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2022-12-31 02:41:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: [SOLVED] running wine in a Bourne shell script using a variable

Why are those backticks there?  If wine happens to print a carriage return to stdout (which wouldn't surprise me) then the error message is not surprising at all.  The backticks-enclosed string is replaced by the result of running that string in a subshell.  So if there is just a \r as a result, bash is telling you that \r (represented in bash's message as $'\r') is not a command ... and that is true.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-12-31 02:46:27

PFleur
Member
Registered: 2022-12-31
Posts: 23

Re: [SOLVED] running wine in a Bourne shell script using a variable

Trilby wrote:

Why are those backticks there?  If wine happens to print a carriage return to stdout (which wouldn't surprise me) then the error message is not surprising at all.  The backticks-enclosed string is replaced by the result of running that string in a subshell.  So if there is just a \r as a result, bash is telling you that \r (represented in bash's message as $'\r') is not a command ... and that is true.

Thanks, that fixed it! I added them since I read that you were supposed to put them around external commands.

Offline

#6 2022-12-31 02:54:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,480
Website

Re: [SOLVED] running wine in a Bourne shell script using a variable

It sounds like you need better reading material.  Backticks are one form of process substitution but they really shouldn't be used as the same can be accomplished with the $(...) syntax.  See below for a couple of good sources on shell scripting:

https://ryanstutorials.net/bash-scripting-tutorial/
http://mywiki.wooledge.org/BashGuide


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB