Basic "scripting" (batch file?) question

Eric D. yellowdog-general@lists.terrasoftsolutions.com
Wed May 22 12:33:01 2002


Thank you very much Mark & Joe for your help.

on 22/5/02 13:44, Mark T. Valites at valites@geneseo.edu wrote:

> in bash, $RANDOM is a good start.  There are plenty of random functions in
> perl if you'd like to go that route.

I'm leery of learning too much all at once so I'll stay far away from perl.

> #!/bin/bash

What does this do? Specify bash as the shell?

> DATE=`date | some_formatting_here` # (or something like date -u +%a)
> # the things within the back-ticks get evaluated & a value returned
> OLD_FOLDER=~already_exists
> NEW_FOLDER=temp.$RANDOM
> mkdir ~$NEW_FOLDER
> mkdir ~$DATE
> mv $OLD_FOLDER/* NEW_FOLDER/
> 
> chmod +x, not -x!!  Probably drove you crazy!  "-" takes the executable
> bit away.

Thank you :) :) :) :)!!!!!!!!!!!!!!!!

Now I'm ready for the next stage of "scripting" :). Is there IF THEN...ELSE
functionality?

What I'd like to do is use time as a condition. e.g.

IF TIME>6 AND TIME<23 THEN...

I presume I can use something like TIME=`date +%H`

ELSE... just let the script exit. Its job is done.

Thanks, Eric.