Reputation: 1
I'm having great difficulty porting a very basic application that I created using mostly bash, which runs on OS X Terminal.
I need to run a similar version of this program on a Windows laptop, so feel that I need to basically rewrite the code. I've tried Linux emulators, and the new Windows 10 bash integration, though features I've used are buggy or do not work.
examples of the simple things I need it to do:
export lev=/home/user/dir
export shu=/home/user/dir
export laptime=/home/user/dir
export currLaptime=/home/user/dir
export currLaptime=/home/user/dir
export infant=/home/user/dir
lev=1;
shu=0;
increments=0.5;
cpuDelay=0.35;
declare -a laptime=('1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1' '1');
say "Distance?";
read distance infant;
if [[ $infant == "i" ]]; then speed=5.5; else speed=6.5; fi
echo $speed "kph";
n=0;
speedCalc=$speed;
for i in `seq 1 21`;
do laptime[n]=$(awk "BEGIN {print ${distance}/($speedCalc/3.6); exit}");
laps[n]=$(awk "BEGIN {print 60/${laptime[n]}; exit}");
laps[n]=$(printf '%.0f' "${laps[n]}");
let n+=1;
speedCalc=$(awk "BEGIN {print ${speedCalc} + 0.5; exit}");
done;
turningRoundTime=$(awk "BEGIN {print ( ( ${distance} * 0.02 - 0.29 ) * -5 ); exit}");
laptimeAdjustment=$(awk "BEGIN {print ${turningRoundTime}-$cpuDelay; exit}");
n=0;
for i in `seq 1 21`;
do laptime[n]=$(awk "BEGIN {print ${laptime[n]}+$laptimeAdjustment; exit}");
let n+=1;
done;
echo "cpu delay: $cpuDelay";
echo "Turning round time: $turningRoundTime";
echo "laptime adjustment: $laptimeAdjustment";
for i in `seq 1 21`;
do
currLaptime=${laptime[lev-1]};
for i in `seq 1 ${laps[lev-1]}`;
do
parallel sh ::: announceLevel.sh sleep.sh; shu=$((shu+1));
done
lev=$((lev+1)); shu=0;
Feel like I'm ready to go back to scratch and create this in another language, one that could be made into an application that might run on Windows, or perhaps Android in future. It works beautifully on the environment that I have set up on OS X, but I just need an indication of which direction to go if I'm to have this run on any other environment.
Many thanks!
Nick
Upvotes: 0
Views: 366