Help troubleshoot script with RANDOM variable

Whether I use the divide signs  /  or  %   it will keep giving me that "usage: sleep time"
error.   echo $randnm  will not echo anything.

I was sure it worked previously but all of a sudden it doesn't anymore

randnm=$[ 1 + $[ RANDOM / 100 ]][5]: 1:  not found
## rndnum=$[ 1 + $[ RANDOM % 100 ]]
sleep $randnm
usage: sleep time
echo $randnm
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.

What is on line 5 of
sunhuxAuthor Commented:
This error 1st appear on the original script below (1st 6-7 lines shown below):

# pull updates from central server
rndnum=$[ 1 + $[ RANDOM % 100 ]]
sleep $rndnum

So line 5 is :
rndnum=$[ 1 + $[ RANDOM % 100 ]]
Should work in bash.
Perhaps you have an old version?
rndnum=$(( 1 + RANDOM % 100 ))
work any better?

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
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Or just:

(( randnm = 1 + RANDOM / 100 ))

Open in new window

sunhuxAuthor Commented:
Thanks, I'll test it out next Tue when back to office.

In the meantime, I have a new requirement in another link below;  if you can have a
look at it & provide sort of Shell or Perl script to be run in Solaris 10, will appreciate it:
sunhuxAuthor Commented:
rndnum=$(( 1 + RANDOM % 100 ))

works fine
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.