You are not logged in.
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`
doneit 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
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
Offline
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
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
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