Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Help Me Please, Bash script
evergreen
post Aug 30 2005, 07:02 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 1
Joined: 30-August 05
Member No.: 5,464



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.
Go to the top of the page
 
+Quote Post
Termina
post Sep 6 2005, 01:55 AM
Post #2


RMS is my Hero
******

Group: Support Specialist
Posts: 862
Joined: 18-February 04
From: Wisconsin
Member No.: 2,404



Any reason you don't just run these yourself, and test them? O_o


--------------------
*Points finger at the author above him* They're a witch! Burn them!
---
Vist my website!
Join me in IRC! Server: st0rage.org Channel: #UnhandledExceptions
Go to the top of the page
 
+Quote Post
chrisw
post Oct 18 2005, 01:16 PM
Post #3


RMS is my Hero
******

Group: Admin
Posts: 634
Joined: 27-September 02
From: Louisiana
Member No.: 5



sounds like another homework question....
matter of fact i was thinking just now...why dont we have
a forum named "Homework Help"...HAHA


--------------------

Chris W.
Go to the top of the page
 
+Quote Post
Hemant
post Oct 18 2005, 01:36 PM
Post #4


RMS is my Hero
******

Group: Support Specialist
Posts: 782
Joined: 6-October 02
From: Trichy,INDIA
Member No.: 29



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 *******)


--------------------
Hemant Kumar
user posted image
hemant@linuxhelp.net
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th October 2017 - 06:27 PM