mercredi 21 décembre 2016

if statement with and shell script

I am trying to make a if statement where if the hour is between 13 and 23 it will set the hour back to 12. Now below is a snippet of my shell script code:

#!/bin/bash

HOUR=$1
if [ $HOUR > 13 ] && [ $HOUR < 23 ];
then
      $HOUR=12
fi

Now I am getting errors when I run this script. How can I tweak this script to get the desired conditions specified above?

Aucun commentaire:

Enregistrer un commentaire