School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,433 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,508 people online right now. Registration is fast and FREE... Join Now!




A simple shell script

 

A simple shell script, Just diplays the user and date with a calendar

IngeniousHax

26 May, 2009 - 03:05 PM
Post #1

D.I.C Addict
****

Joined: 28 Mar, 2009
Posts: 607



Thanked: 14 times
My Contributions
if anyone could maybe give me a link to a good beginners shell scripting pdf or anything, I'd greatly appreciate it. What is the wc -l command in this little program?

#
#
# Script to print user information who currently login , current date & time
#
clear
echo "Hello $USER"
echo "Today is " ;date
echo "Number of user login : " ;who | wc -l
echo "Calendar"
cal
exit 0

Sorry for no code brackets, I tried it and it wouldn't post it, just gave me the timer running infinitely.

User is offlineProfile CardPM
+Quote Post


mocker

RE: A Simple Shell Script

26 May, 2009 - 03:15 PM
Post #2

D.I.C Regular
Group Icon

Joined: 14 Oct, 2007
Posts: 433



Thanked: 33 times
Dream Kudos: 25
My Contributions
wc -l is used to count the number of lines. wc by itself counts words. A lot of shell scripting is knowing how to use the command line properly.
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html is a pretty good introduction, and don't forget to abuse "man" to find out more information about a program.

You can lookup the man pages at http://linux.die.net/man/ as well, which I find to be easier to read
User is offlineProfile CardPM
+Quote Post

IngeniousHax

RE: A Simple Shell Script

26 May, 2009 - 03:38 PM
Post #3

D.I.C Addict
****

Joined: 28 Mar, 2009
Posts: 607



Thanked: 14 times
My Contributions
Excellent thank you.

NOTE** for any mod that comes by and sees the double post, i apologise as my computer didn't show the post, and simply kept the sending timer running, so I would quit out, and that's why the second one has an image.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:47AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month