sam
1
I m checking idle time using vmstat, below are the results
var=$(ssh wmtmgr@$hostname vmstat | tail -1 | awk '{print $15}')
89
and now im subtracting 89 with 100 & im getting expected results
expr 100 - $var
11
Now How can I get the result 11 in one line code?
Hello sam@sam,
You could use following for same.
var=$(ssh wmtmgr@$hostname vmstat | tail -1 | awk '{print 100 - $15}')
echo $var
Thanks,
R. Singh
RudiC
3
How about vmstat 1 1
instead of piping through tail -1
?
sam
4
Thanks R.P singh, it works,
@RudiC
If I use vmstat 1 1 or vmstat both are giving same results
RudiC
5
... but you save a tail
process.