Avatar of erikTsomik
erikTsomikFlag for United States of America

asked on 

Bash File on Windows

I need to convert sh file from Linux to be run on windows with PHP . I have the code in PHP executing the sh
$RESULTFILE = "/home/txi/score/temp_results/" . "results." . "$USERID" . "$TTYCPEID" . "$now.tmp";

	

	$COMMAND = "/home/txi/score/score.sh $FILENAME $RESULTFILE";
	$RUNSCORE = exec("$COMMAND");

Open in new window



the sh file looks like this

#!/bin/bash

export $WINEPREFIX=/var/www/.wine
/usr/local/bin/wine /home/txi/score/SCORE.EXE /home/txi/score/3030M.TXT $1 $2 2>/home/txi/score/ERRORS
touch /home/txi/score/WORKED

Open in new window

Linux* BashPHPWindows OS

Avatar of undefined
Last Comment
erikTsomik
Avatar of Adam Brown
Adam Brown
Flag of United States of America image

Avatar of erikTsomik
erikTsomik
Flag of United States of America image

ASKER

What that will do. currently they are using wine. and have to call the exe file. I dont event know what that exe is doing 
Avatar of arnold
arnold
Flag of United States of America image

If not mistaken, wine is a Windows emulator on Linux.

So you are on Windows and would like a way to run a Windows emulator to run a Windows command.
What does the process do in Linux and then use MS native tools, powershell, vb,script, etc to achieve the same result.

If it is PHP, ...
Use the php interpreter and ......
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

ASKER

can in my code I can run something like this. Where cmd is a substitute for wide since I am on Windows anyway

#!/bin/bash


c:/windows/system32/cmd.exe C:/websites/TTY-PASS/score/SCORE.EXE C:/websites/TTY-PASS/score/3030M.TXT $1 $2


Open in new window

Avatar of arnold
arnold
Flag of United States of America image

You do not need to prepend anything to run score.
Echo @off
Wine is an emulator.
If score.exe is a Windows command it just needs to be run.
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

ASKER

so the code will look like this

#!/bin/bash


c:/windows/system32/cmd.exe C:/websites/TTY-PASS/score/SCORE.EXE C:/websites/TTY-PASS/score/3030M.TXT $1 $2

Open in new window

Avatar of arnold
arnold
Flag of United States of America image

First, you do not need cmd.exe

The quick thing, run score.exe to see it does what you expect.

You do not need cmd.exe in the line.
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

@arnold: Sorry, couldn't resist ;)
If not mistaken, wine is a Windows emulator on Linux
Yes, you are mistaken, WINE stands for Wine Is Not an Emulator
But it does run many Windows programs under Linux. Under Windows, why would you want it? - you are already under Windows
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

ASKER

when trying to execute this code it gives me 500 error

$COMMAND = "C:/websites/score/score.sh $FILENAME $RESULTFILE";
echo $COMMAND;   

$RUNSCORE = exec("$COMMAND");

Open in new window

The sh file looks like this
#!/bin/bash


C:/websites/score/SCORE.EXE C:/websites/score/3030M.TXT $1 $2 2>C:/websites/score/ERRORS


Open in new window

ASKER CERTIFIED SOLUTION
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Windows OS
Windows OS

This topic area includes legacy versions of Windows prior to Windows 2000: Windows 3/3.1, Windows 95 and Windows 98, plus any other Windows-related versions including Windows Mobile.

129K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo