Windows CMD versus GNU Bash

Windows CMD

@echo off

SETLOCAL enableextensions

FOR /F "tokens=1 delims= " %%I IN ('date /T') DO SET D=%%I
FOR /F "tokens=*" %%J IN ('time /T') DO SET T=%%J

move .\encode .\encode.bat

echo. && echo Starting at %T% on %D%! && echo.

.\timethis.exe .\encode.bat | .\grep.exe "Elapsed Time" >.\RESULTS.txt

del .\benchmark*
move .\encode.bat .\encode
echo. && echo. && echo Approximate start time was %T% on %D%!
FOR /F "tokens=1 delims= " %%I IN ('date /T') DO SET D=%%I
FOR /F "tokens=*" %%J IN ('time /T') DO SET T=%%J
echo Approximate finishing time was %T% on %D%! && echo. && echo.
echo Das Ergebnis findet sich nun in der Datei "RESULTS.txt"!
echo ===
echo The Results are now to be found in the file "RESULTS.txt"!

ENDLOCAL

pause

GNU Bash

#!/bin/bash

ISODATE=$(date -I)
TIME=$(date +'%H:%M:%S')

mv encode encode.sh
chmod +x encode.sh
echo "Starting at ${TIME} on ${ISODATE}!"

/usr/bin/time -f 'Elapsed Time %e' -o "./times.txt" ./encode.sh &> x264_output.txt

rm benchmark*
mv encode.sh encode
chmod -x encode

echo "Approximate start time was ${TIME} on ${DATE}!"
ISODATE=$(date -I)
TIME=$(date +'%H:%M:%S')
echo "Approximate finishing time was ${TIME} on ${DATE}!"
echo "Das Ergebnis findet sich nun in der Datei \"times.txt\"!"
echo "==="
echo "The Results are now to be found in the file \"times.txt\"!"

Comentarios