我有一个.sh
文件,我想将其转换为.bat
文件。下面你可以看到我的shell脚本,下面是我将shell脚本转换为批处理文件的可悲尝试。我能够隐藏一些零件,但其他零件"难倒"我,就像试图将node pong.js $1
命令的输出回显到__pongjs_output.txt
。
# Run a .php file both on pong.js and php and diff the output.
# Run on pong.js
node pong.js $1 > __pongjs_output.txt
# Run on node and replace some property names.
php $1 > __php_output.txt
echo "$1:"
diff __pongjs_output.txt __php_output.txt && echo "ok"
rm __pongjs_output.txt __php_output.txt
我尝试将shell文件转换为批处理文件:
@ECHO off
REM Run a .php file both on pong.js and php and diff the output.
REM Run on pong.js
ECHO node pong.js %1 > __pongjs_output.txt
REM Run on node and replace some property names.
ECHO php %1 > __php_output.txt
ECHO %1:
FC __pongjs_output.txt __php_output.txt
IF errorlevel 0 ECHO ok
DEL __pongjs_output.txt __php_output.txt
答案 0 :(得分:2)
试试这个(从节点和php之前删除ECHO):
@ECHO off
REM Run a .php file both on php.js and php and diff the output.
REM Run on pong.js
node pong.js %1 > __pongjs_output.txt
REM Run on node and replace some property names.
php %1 > __php_output.txt
ECHO %1:
FC __pongjs_output.txt __php_output.txt
IF errorlevel 0 ECHO ok
DEL __pongjs_output.txt __php_output.txt