I'm using the Bourne shell and trying to write a script that will add all the time that any particular user has been on the network for.
I've used last-h | grep "username" | cut -c 58-62 to get the times.
Then I wrote a script that takes the time and converts it into just minutes.
Now I want to add all the minutes together to arrive at a total time.
I'm using expr; I keep getting a non-numeric expression error..I guess that means that the numbers I'm generating are strings and not just numbers?
Is there a way to convert a string, such as "345" into an integer so that you can use expr on it?
Is there any better way to approach getting total time on the network for any particular user?