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))