Witam.
Mam do napisania prosty program, którego problem tak naprawdę sprowadza się do podzielenia danej liczby przez dwa i zaokrągleniu wyniku w dół.
Problem polega na tym, że dane do testów podane są w formie liczby z kropką
test3 = run_shell args: ['12.3']
test4 = run_shell args: ['0.82']
test5 = run_shell args: ['11.8']
test6 = run_shell args: ['1787']
test7 = run_shell args: ['0']
Mój kod poniżej
#!/bin/bash
time=$1
echo $(($time/2))
Dla powyższych danych testowych serwer wyrzuca mi błędy np
bash: line 2: 1.4/2: syntax error: invalid arithmetic operator (error token is ".4/2")
bash: line 2: 12.3/2: syntax error: invalid arithmetic operator (error token is ".3/2")
bash: line 2: 0.82/2: syntax error: invalid arithmetic operator (error token is ".82/2")
Nie wiem jak to obejść.