Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-25-2005, 08:27 AM   #1
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

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

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

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

Rep: Reputation: 15
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
Registered: Jul 2003
Posts: 34

Original Poster
Rep: Reputation: 15

thank you


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

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

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