help me do a small program!! THX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help me do a small program!! THX
# 1  
Old 09-10-2006
help me do a small program!! THX

Write a shell script (to run on the Bourne shell) that runs an infinite loop to check every 5 seconds to report on who logs into and who logs out of a UNIX system. Without loss of practical significance of this little utility, we can ignore multiple logins from the same user during a time period of less than 5 seconds.

You would need to research these UNIX commands: cut, sort, cmp.

Your script for this task must be named log.sh. The following is a sample output of the script (It is OK that the script leaves behind a temporary file when it is finally interrupted). The $ is the shell prompt.

$ log.sh
The current users are:
abc1
rv0
sxu
tgray

No user has logged in/out in the last 5 seconds.

No user has logged in/out in the last 5 seconds.

User rsmith has logged in.

No user has logged in/out in the last 5 seconds.

User abc1 has logged out.

No user has logged in/out in the last 5 seconds.
... ... ... ... ... ... ... ...
# 2  
Old 09-10-2006
No homework/classroom problems allowed. Thread closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies

2. Shell Programming and Scripting

Making a bash script and small C program for a homework assignment

Here's the assignment. I'll bold the parts that are rough for me. Unfortunately, that's quite a bit lol. The syntax is, of course, where my issues lie, for the most part. I don't have a lot of programming experience at all :/. I'd post what I've already done, but I'm so lost I really don't know... (1 Reply)
Discussion started by: twk101
1 Replies

3. Homework & Coursework Questions

Small Grading Program

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1. Create a series of commands for a grading program. Create a grades file. Put a "tab" between the name and... (7 Replies)
Discussion started by: Jagst3r21
7 Replies

4. Solaris

Plz help me with linked filesystems...thx

SunOS 5.10 Generic_142900-15 sun4u sparc SUNW,SPARC-Enterprise I need sys-admin help from someone. I have 2 file systems that are both mounted /CV and /eabatch. under /eabatch/in/data is a hardlink to to /CV/in/data lrwxrwxrwx 1 batchop batchtaa 11 Mar 6 2009 data -> /CV/in/data... (2 Replies)
Discussion started by: Harleyrci
2 Replies

5. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

6. Shell Programming and Scripting

main program is not calling small other programs

I am trying to understand a program in a book and this program suppose to call other programs which are in the same folder, the other programs are called 'lu' and 'add' but for some reason when it gets to the last line of each case to call these programs there is an error message saying ./rolo:... (2 Replies)
Discussion started by: bartsimpsong
2 Replies

7. UNIX for Dummies Questions & Answers

Small Program with variables

Hello Geniuses of the unix world. please help, stupid chemist. I have the following script that I need to create a file. Doesnt make sense unless i explain this way: I need to create a file called summary.in I would like all these lines to be inserted however in the command line I would like the... (1 Reply)
Discussion started by: gingburg
1 Replies

8. Shell Programming and Scripting

need help with AWK - urgent - Thx

Hi, I have the following code (I inherited and am new to awk): nawk -F, '{OFS=","; print $1,$2,"0000"$3" ",$4" PH",$6," PAYROLL HOURS USD ",$5,$7,$8}' /tmp/payfile > /tmp/paywork1 Q: How do I modify this so that... (6 Replies)
Discussion started by: mtn17
6 Replies

9. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

10. Programming

execution small C++ program in UNIX

Hi my friends I am beginner unix programmer I have written small c++ program in text editor and I have change it mode to 555 to make it executable file to use it in unix O.P. #include<iostream.h> main() { cout<<"Hello World"; } but some syntax erroe came for << can any one help... (5 Replies)
Discussion started by: bintaleb
5 Replies
Login or Register to Ask a Question