Bruno Haible wrote: > Pádraig Brady wrote: > >> Hmm it's a bit surprising that min()/max() are not available >> as $((shell arithmetic)) or in `expr`. Consequently I agree that >> adding the option you suggest is useful. > > But min() and max() are available through the 'test' > program or shell built-in command. If the user can write > > n=`count-cores` > test ! $n -gt 5 || n=5 > test ! $n -lt 2 || n=2 > > there is no big advantage in additional optional that allow him to > write > > n=`count-cores --min=2 --max=5`
No big advantage no. But when you also add in the relative calculation for getting n-1 for example, then it's get's a little too messy in shell for a very common case. cheers, Pádraig.