A
A
Adept Popken2016-06-17 14:38:47
bash
Adept Popken, 2016-06-17 14:38:47

BASH script, why doesn't the comparison pass?

I'm trying to make a script, for kicking a 3g modem, in case of a long timeout (large losses). I did the ppp lifting part in another script, I can't implement the check logic...
#!/bin/bash
ping ya.ru -c 6 > inet
varloss=cat inet | grep loss | cut -f 6 -d " " | cut -f 1 -d "%"
alertvalue=50
echo "$varloss% loss!"
if $varloss > $alertvalue
then echo "The modem needs to be restarted and run the script"
else echo "Everything is calm!"
fi

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2016-06-17
@adept7771

RTFM https://www.opennet.ru/docs/RUS/bash_scripting_gui...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question