Need help with parameter expansion

Say you have this numeric variable that can be set by the user but you never want it to leave a certain range when it gets printed. How could you use parameter expansion such that it will never expand outside of that boundary? Thanks

---------- Post updated at 11:09 PM ---------- Previous update was at 10:57 PM ----------

Bah nevermind looks like the ternary operator is the answer and not parameter expansion

I was running this script every so many seconds using sleep but on the first attempt I didn't want it to sleep less than 60 seconds, but the user could specify higher. On subsequent attempts I didn't want the user to specify lower than 20s.

So for the first attempt I have something like:

sleep $(($frequency > 60 ? $frequency : 60))

and subsequent attempts:

sleep $(( $frequency > 20 ? $frequency : 20))

So do you still have a question or is everything working as intended?

add a space after (( and before the endind ))

sleep $(($frequency > 60 ? $frequency : 60))
sleep $(( $frequency > 60 ? $frequency : 60 ))

sould work :

# date && sleep $(( $frequency > 5 ? $frequency : 5 )) && date
oct 14 09:55:12 CEST 2010
oct 14 09:55:17 CEST 2010
# frequency=10
# date && sleep $(( $frequency > 5 ? $frequency : 5 )) && date
oct 14 09:55:33 CEST 2010
oct 14 09:55:43 CEST 2010

Yea I'm good :b: