LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-25-2005, 08:27 AM   #1
BruceC
Member
 
Registered: Jul 2003
Posts: 34

Rep: Reputation: 15
Basic bach scripting


I have a simple task to perform with a script.

Test for the current hour, if it is 22 then init 0

To test my code I am using the echo command with date.
The following line gives unknown command:
hour = $date +%H

This just echos the text "date +%H"
echo date +%H

This echoes the current hour:
date +%H

This is what I'm actually trying to do:
#############
hour = $date +%H
if $hour = 22 ; then
init 0
fi
#############

How do I properly assign the current hour to a variable the work with it?
 
Old 02-25-2005, 08:40 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,783

Rep: Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936Reputation: 5936
hour = $( date +%H )
 
Old 02-25-2005, 08:43 AM   #3
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
Or
Code:
hour=`date +%H`
 
Old 02-25-2005, 08:49 AM   #4
cadkins
Member
 
Registered: Mar 2004
Location: <----- there
Distribution: Mandrake 9.0 - 9.2, Slackware 9.1 - 10
Posts: 98

Rep: Reputation: 15
Quote:
Basic bach scripting
Well you start with a theme, this theme is then harmonized according to the baroque method of counterpoint. Could do a suite. Just follow the PACSOG method. Prelude, Allegro, Courante, Sarabande, Other (maybe minute) followed by a Guige. Just make sure it's all in the same key.

sorry.........couldn't resist. Feeling a little silly today No offense
 
Old 02-25-2005, 09:31 AM   #5
BruceC
Member
 
Registered: Jul 2003
Posts: 34

Original Poster
Rep: Reputation: 15
Bingo!

thank you
 
  


Reply



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
cvs bach script alaios Linux - General 4 08-30-2004 08:49 PM
bach scripting and escape characters... Bud-froggy Linux - Newbie 3 07-09-2004 04:55 PM
very basic scripting question spatter9999 Programming 3 09-18-2003 01:36 AM
Basic BASH scripting question Dark_Helmet Programming 3 06-26-2003 05:45 PM
I'm a BASIC chap, looking for some info on BASIC programming CragStar Programming 2 01-21-2001 09:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:30 AM.

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