0

I am not sure if it is one or two issues here:

file /usr/bin/line1

wine /home/aiao/.wine/drive_c/Program\ Files\ \(x86\)/LINE/Line.exe > /dev/null 2>&1

file /usr/bin/line2

!#/usr/bin/bash
wine /home/aiao/.wine/drive_c/Program\ Files\ \(x86\)/LINE/Line.exe > /dev/null 2>&1

The wine command itself works fine but when I run /usr/bin/line1, I get:

: ambiguous redirect1: 1

And when I run /usr/bin/line2, I get:

wine: bad interpreter: No such file or directory

How can I run command through bash script? What is going on here?

2
  • Wait, are you sure you have the errors matched with the correct files in your question? – Dan Aug 8 '14 at 19:46
  • @dan08 just ran them again to double check.... Yes they are right. – aiao Aug 8 '14 at 19:48
1

For starters you need a valid shebang. Your second file almost has one but the !# are the wrong way around. Second up you need a valid interpreter! None of my systems have a /usr/bin/bash, it's just /bin/bash. You could even just use /bin/sh. It's ever-so-slightly lighter.

The following should work:

#!/bin/sh
wine /home/aiao/.wine/drive_c/Program\ Files\ \(x86\)/LINE/Line.exe > /dev/null 2>&1
0

In the first file you can redirect the output just using > /dev/null or &> /dev/null that will redirect stdout and stderr so no need for 2>&1.

In the second file, I believe the correct interpreter is #!/bin/bash.

2
  • but this is exactly the command that executes fine if run directly. Why is that? Also changing the shebang made no difference – aiao Aug 8 '14 at 19:40
  • I have a bad theory: when the command is run in a file there are two stdouts (and stderrs), One from the command in the the script and one from the command the runs the script. Therefore the redirect is ambiguous as to which stdout you are referring. I have no information to back that theory. – Dan Aug 8 '14 at 19:44
0

the file handles 1 and 2 (stdout & stderr) may be closed by wine, because it doesn't use them and may even free up 0 (stdin) once it has established a keyboard handler. Also this would be more fair to windows as all file handles are available as it kind of expects in a new program-instance.

0

First of all: You're using Wine which in this case may need to recreate something that mimics the runtime environment of a Windows command shell (cmd.exe).

As you have not told what drive_c/Program\ Files\ \(x86\)/LINE/Line.exe is, there is no way to tell its requirements.

Now : ambiguous redirect1: 1 looks as a possible output from either Wine or cmd.exe.

May be you need to ensure that ONLY WINE is affected by the Linux style redirects. You may need to look into what Wine expects, and how to protect/separate its parameters from those caught by bash and vise versa.

Things to try:
As it works from the bash command prompt try source line2 for starters.

If that works, maybe a try a variant like this - from a script:

bash <<EOF
wine /home/aiao/.wine/drive_c/Program\ Files\ (x86)/LINE/Line.exe > /dev/null 2>&1
EOF

Yet another...
start is a Windows command line tool that applies the same tasks as a double-click on e.g. a link or file, so try:

wine start /home/aiao/.wine/drive_c/Program\ Files\ \(x86\)/LINE/Line.exe 

Note: WITHOUT the redirection, if that works to actually have the program run, then - if you still need it, you might try adding >/dev/null 2>&1 (or whatever from the other answers) for Wine.

3
  • Non worked. (source line2), (source line1), (./line), (. line). Line messenger (naver line) is a program very similar to skype.exe. Please tell me what more do you need to know, and why it matters. – aiao Aug 8 '14 at 20:41
  • Well, do you have a Windows machine to try it out on? I wouldn't be surprised if it works there. Does Line.exerequire hardware? Does it USE hardware in your installation? I'll add one more thing to try above... – Hannu Aug 9 '14 at 15:48
  • If you get error messages as you try, do add them to your question above (all of it). They may help in getting further. – Hannu Aug 9 '14 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.