![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Storing commands in $variables. | Paulw0t | Shell Programming and Scripting | 7 | 08-08-2008 05:42 PM |
| Using variables in sed commands | hcclnoodles | Shell Programming and Scripting | 2 | 01-02-2007 08:56 AM |
| Referencing variables in commands | mharley | Shell Programming and Scripting | 3 | 03-31-2005 01:37 AM |
| Passing variables/arguments/parameters to commands | Perderabo | Answers to Frequently Asked Questions | 0 | 06-13-2004 07:37 PM |
| Subing Variables with commands. | Astudent | UNIX for Dummies Questions & Answers | 1 | 02-26-2001 05:02 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I have this idea.
I have a variable for the start of someones log in time, (start=`who am i | cut -c30-34`) and a variable for the log out time or present time, (end=`date | cut -c12-16`) but how do I go about subtracting them to get the total log in time. I've tried adding a another variable total. total=$end-$start, but that's just prints out everything in a numeric fashion.(2:30-2:10) and if I use expr I get an error message saying "expr: non-numeric argument" Now this seems simple but why won't this work. Please Help. theA |
|
||||
|
Using last is the better solution, but there needs to be some logic coded in. The problem is the case where the user has been logged in for more than 24 hours, last gives you something like:
chuckb xdmremote sunws6:0 Tue Mar 27 07:36 - 13:45 (2+06:08) In this case I have been logged in for more 2 days, 6 hours and 8 minutes. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|