Score:0

Adding total session time

dk flag

I'm trying to get the total session time a user has had in a month using the command last in a script.

last user | egrep -i month | tr -s ' ' '/' | cut -f11 -d/ 

when adding the results I'm using expr to add the times, but I'm unable to get the total of hours and minutes.

terdon avatar
cn flag
Please [edit] your question and show us the output of `last user` and also the output of `last user | egrep -i month | tr -s ' ' '/' | cut -f11 -d/ ` as well as exactly what you pass to `expr` so we know what data you are trying to parse.
terdon avatar
cn flag
By the way, `egrep` is deprecated, please use `grep -E` but in this case, you don't even need it, just use `grep -i`.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.