Help - Search - Members - Calendar
Full Version: Help Me Please
Linuxhelp > Support > Programming in Linux
evergreen
Hi,
Can someone tell me if these answeres are correct?


1) a system administrator maintains a file with birthdates of all users in /etc/birthdates. The file contains a line for each user, and is updated with the addition of every new user. Each line /etc/birthdates has the following format:

login name: real name: birthdate



#!/bin/sh

DATE=`date '+%d-%m-%y'`

USERS=`grep $DATE /etc/bithdates awk -v FS=":" '{ print $1 }'

for USER in $USERS

do

echo "Happy birthday !" | mail $USER

done


2)1. How to write a bash script that

a. runs automatically every time you log in.

user need to include scripts directly into .bashrc so they could run each time user's shell login





b. tells you when you last logged in.



ans1) lastlog | grep $USER


ans 2) last | grep $USER | head -n 2 | tail -n 1 | awk {'print $3" "$4" "$5" "$6'}

which one is correct?




c. tells you the number of times you have logged in before now.


last | grep $USER | wc -l



Please let me know if these are correct?.

Thanks.
Termina
Any reason you don't just run these yourself, and test them? O_o
chrisw
sounds like another homework question....
matter of fact i was thinking just now...why dont we have
a forum named "Homework Help"...HAHA
Hemant
Yeah.. but you got to use your credit card to access that forum. That would be cool.
Joey, needs all help he can get.(I mean after *******)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.