05-23-2011
Shell program for beginners
Hey, i hope someone can help me with this program.
I need to write a program in shell which will return how many times and how much time have users been logged in system between two dates. We give time as 2 dates as arguments in command line.
Example:
$ nameofprogram 27/04 06/05
returns this:
user1 2x 0 days 2:46
user2 4x 0 days 11:42
user3 2x 0 days 1:58
user4 3x 1 day 18:41
As i find it really hard to programm in shell, i hope someone can help me with this. Thanks
9 More Discussions You Might Find Interesting
1. Programming
Good morning. Thanks for the very valuable hard-to-find information I get from you guys.
Can anybody give any suggested websites or references for anyone who wants to begin learning on programming applications in X? Thanks to anyone in advance... (1 Reply)
Discussion started by: jfsuminist
1 Replies
2. UNIX Desktop Questions & Answers
does anyone know of a course for unix beginners (1 Reply)
Discussion started by: moose
1 Replies
3. UNIX Desktop Questions & Answers
I am new to non Windows operating systems. Does anyone have advice on which UNIX OS vendor would be good for learning purposes. I was looking for a version of UNIX that runs on the Intel platform. Do you have any recommendations on where to purchase the software? Thank you. (14 Replies)
Discussion started by: jmy113437
14 Replies
4. Shell Programming and Scripting
hi,
i start using awk and have a very basic problem. here's my code:
#! /usr/bin/awk -f
# 2010, scz
#
{
$1 == "test" { print $2 }
}
this works on the command line but not as "program" - what is the difference between awk programs on the command line and executing awk... (3 Replies)
Discussion started by: svencz
3 Replies
5. UNIX for Dummies Questions & Answers
i'm just a beginner in unix environment- please help which book to read and which os to use!!! :confused: seriously i've no idea what is unix or how much capable it is!! (1 Reply)
Discussion started by: gaurav singh
1 Replies
6. OS X (Apple)
(Apologies for any typos.)
Well hands up those who have been in the following situation(s):-
Your partner, (in my case the missus), sees that you are messing
with your machine and says something like, "can you keep an eye
on the dinner, I am going out shopping", and you look up glazed
eyed... (3 Replies)
Discussion started by: wisecracker
3 Replies
7. UNIX for Dummies Questions & Answers
hi all,
Can you suggest me a ebook for unix beginners. I am new to unix. (2 Replies)
Discussion started by: rajasingam
2 Replies
8. UNIX for Beginners Questions & Answers
Hello!
I need some advices from You. How many days i need to setup cluster using virtual box for mid exp user? Do you have any ideas related to master thesis related to clustering? I need to include some search aspect within that topic.Can You recommend some books/docs about that case?
Thank... (4 Replies)
Discussion started by: protos27
4 Replies
9. UNIX for Beginners Questions & Answers
I want to get a Linux Certification to start my Career in IT sector. My Qualification is MCS from a top university. Suggest me some Linux Certifications. (1 Reply)
Discussion started by: alexwatson1711
1 Replies
PIDOF(8) Linux System Administrator's Manual PIDOF(8)
NAME
pidof -- find the process ID of a running program.
SYNOPSIS
pidof [-s] [-x] [-o omitpid] [-o omitpid..] program [program..]
DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. This program is on some systems
used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in
/etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead.
OPTIONS
-s Single shot - this instructs the program to only return one pid.
-x Scripts too - this causes the program to also return process id's of shells running the named scripts.
-o Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof pro-
gram, in other words the calling shell or shell script.
NOTES
pidof is simply a (symbolic) link to the killall5 program, which should also be located in /sbin.
When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that
it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs.
SEE ALSO
shutdown(8), init(8), halt(8), reboot(8)
AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl
01 Sep 1998 PIDOF(8)