N'th: Difference between revisions

Content deleted Content added
BigL (talk | contribs)
No edit summary
Markjreed (talk | contribs)
→‎{{header|UNIX Shell}}: Support negative numbers
Line 3,307:
local ordinals=(th st nd rd)
local -i n=$1 i
if (( n < 0 )); then
printf '%s%s\n' - "$(nth $(( -n )) )"
return 0
fi
case $(( n % 100 )) in
11|12|13) i=0;;