bash if condition, then continue

Need a quick bash solution to the following problem...

A bash script is starting before the system has it's dhcp address and therefore it is failing.
It is further failing because it is taking a while for the system to get it's updated time from it's default of 1970.

I need to run a one time test at the very start of my script which will check to see what year it is.
If the year is not 20xx then it implies that full network connectivity has not been achieved yet so repeat the test.
Once the system year is 20xx, it means that the network has started and that the system has internet access so time to end this function and continue the script.

-script starts up
-checks to see what year it is on the system
-if the year is 1070, then loop and try trying again one second later
-Once the year is 20xx, this function dies for good and the script continues on to it's main functions
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

while :
      if [[ $(date "+%Y") -ge 2000 ]]
           sleep 1
# Script continues here if year >= 2000
projectsAuthor Commented:
So, just put that at the very top of my script, even before all of my variables, just underneath

That's what I did and this seems to work perfectly.

I am assuming this covers all 20xx

Yes, you can put it just below the "shebang" line, it doesn't require any preliminary setup.
And yes, it covers all 20xx, but also all 21xx, 22xx, ..., 30xx, 31xx, 32xx, ... and so on. If this is not desired, please let me know,

I wrote the first solution a bit "for demonstration purposes".
Of course we can make it shorter:

while [[ $(date "+%Y") -lt 2000 ]] ;
   sleep 1

Behind the scenes this contains the same logic, but I think it looks a bit more "elegant".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

projectsAuthor Commented:
So long as you tested the second one and it does the same thing, perfect! :)

Thanks very much.
Yes, it's tested - well , not with the actual system date (a thing I don't like to mess around with), but with a freehand variable.
projectsAuthor Commented:
Works like a charm, thanks very much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.