(RESOLVED) BASH scripts for automation

This post was from a previous version of the WRF&MPAS-A Support Forum. Please do not add new replies here and if you would like the thread moved out of the Historical / Archive section then contact us, making sure to include the link of the thread to be moved.

Whatheway

Member
Good evening everyone,

I am following a tutorial online for setting up the WPS/WRF and I would like to automate the process some in a script.
I am trying to write a IF/ELSE statement that will look at the UTC time on my desktop and round down to the nearest run.

This is what I have come up with but I can't see to get it to run.

Any help would be great!

#!/bin/bash

UTC_TIME= if [`date +%H -u` -ge 0] && [`date +%H -u` -lt 5]
then UTC_TIME=0
elif [`date +%H -u` -ge 6] && [`date +%H -u` -lt 11]
then UTC_TIME=6
elif [`date +%H -u` -ge 12] && [`date +%H -u` -lt 17]
then UTC_TIME=12
else [`date +%H -u` -ge 18] && [`date +%H -u` -lt 23]
UTC_TIME=18
fi

echo $UTC_TIME
 

kwerner

Administrator
Staff member
Hi,
Unfortunately the wrf support team does not have the resources to support scripting that isn't part of the WRF code, but hopefully someone in the community will be able to provide some tips!
 

Whatheway

Member
RESOLVED:

hour=`date +%H -u`

if [[ $hour -ge 00 && $hour -le 05 ]]; then
STARTHOUR=00
fi

if [[ $hour -ge 06 && $hour -le 11 ]]; then
STARTHOUR=06
fi

if [[ $hour -ge 12 && $hour -le 17 ]]; then
STARTHOUR=12
fi

if [[ $hour -ge 18 && $hour -le 23 ]]; then
STARTHOUR=18
fi
 
Top