Answer the question
In order to leave comments, you need to log in
`
Why can't I perform arithmetic on a variable received via curl?
For example:
#!/bin/bash
last_time_online=`curl -s "http://lolygirl.ru/time_online.php?client=clear"`
curr_date=`date +%s`
echo $(($curr_date - $last_time_online))
Answer the question
In order to leave comments, you need to log in
in last_time_online after the last digit there is one more character, it must be cut off
last_time_online=`curl -s "http://lolygirl.ru/time_online.php?client=clear"`
last_time_online=${last_time_online:1:${#last_time_online}-1}
curr_date=`date +%s`
echo $(($curr_date - $last_time_online))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question