LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Basic bach scripting (https://www.linuxquestions.org/questions/linux-newbie-8/basic-bach-scripting-294708/)

BruceC 02-25-2005 08:27 AM

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?

michaelk 02-25-2005 08:40 AM

hour = $( date +%H )

harken 02-25-2005 08:43 AM

Or
Code:

hour=`date +%H`

cadkins 02-25-2005 08:49 AM

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 :p No offense :)

BruceC 02-25-2005 09:31 AM

Bingo!

thank you


All times are GMT -5. The time now is 08:47 PM.