LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-02-2006, 09:19 AM   #1
Gary_Menegon
Member
 
Registered: Jun 2004
Location: Joliet, Illinois
Distribution: slackware
Posts: 38

Rep: Reputation: 15
shell script variables


I have then following script:
#!/bin/bash
#calendar2 - try to automate calendar
$1
for NUM in 1 2 3 4 5 6 7 8 9 10 11 12
do
cal "$NUM" "$1"
echo
sleep 5
done
echo
exit 0

This sort of works, but what I really what is to be prompted to enter a year to display entire year calendar. Also is there a complied list of common script commands, such as READ, ECHO, FOR, WHILE and so forth?

Thankyou in advance!
sincerely,
Gary
 
Old 10-02-2006, 09:28 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
what I really what is to be prompted to enter a year to display entire year calendar.
Code:
echo "Gimme year, and make it snappy:"; read year; echo "got variable \$year=$year"

is there a complied list of common script commands
"man bash" should do and here's some Bash scripting guides:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a trailing zero to shell-script variables? Yalla-One Linux - General 3 12-11-2005 04:04 PM
Need help setting environment variables via shell script srosburg Linux - Newbie 2 12-08-2005 07:58 PM
Setting environment variables from shell script theta Linux - General 5 09-02-2004 08:50 PM
Passing variables from AWK script to my shell script BigLarry Programming 1 06-12-2004 04:32 AM
Why?? can not use variables with shell script Bassam Linux - General 9 01-27-2004 07:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration