我必须在.sh代码中转换以下.bat代码:
@ECHO OFF
REM Checking necessary files
SET "PHP_BIN=C:\Program Files\xampp\php\php.exe"
SET "PHP_RUN_FILE=user_integration.php"
SET "WWW_DOCUMENT_ROOT=C:\moodle\server\moodle"
SET "PHP_INI=C:\Program Files\xampp\php\php.ini"
SET "WWW_RUN_FILE=%WWW_DOCUMENT_ROOT%\batch\user_integration\%PHP_RUN_FILE%"
IF NOT EXIST "%PHP_BIN%" GOTO :PHP_BIN_NOT_INSTALLED
IF NOT EXIST "%WWW_RUN_FILE%" GOTO :WWW_RUN_FILE_NOT_INSTALLED
GOTO :RUN
:PHP_BIN_NOT_INSTALLED
ECHO %PHP_BIN% does not exist
REM GOTO :END
:WWW_RUN_FILE_NOT_INSTALLED
ECHO %WWW_RUN_FILE% does not exist
REM GOTO :END
:RUN
"%PHP_BIN%" -c "%PHP_INI%" -f "%WWW_RUN_FILE%"
pause
REM GOTO :END
:END
@ECHO ON
请帮助,谢谢。
答案 0 :(得分:1)
怎么样:
#!/bin/sh
/usr/bin/php -i /path/to/php.ini -f /path/to/user_integration/user_integration.php