mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-16 04:42:55 +08:00
slightly longer explanation
This commit is contained in:
parent
13d397f4dc
commit
e541f12bdb
@ -11,9 +11,15 @@ function commanum () {
|
|||||||
#[ $(echo $- |grep i |wc -l) -gt 0 ] &&
|
#[ $(echo $- |grep i |wc -l) -gt 0 ] &&
|
||||||
[ ! "$1" = "" ] && commanum $1
|
[ ! "$1" = "" ] && commanum $1
|
||||||
|
|
||||||
|
exit;
|
||||||
|
|
||||||
# Example usage:
|
# Example usage:
|
||||||
#$ tmpvar=$(./commasep-num.mrg 80000000000)
|
#$ tmpvar=$(./commasep-num.mrg 80000000000)
|
||||||
#$ echo $tmpvar
|
#$ echo $tmpvar
|
||||||
#80,000,000,000
|
#80,000,000,000
|
||||||
# Limitation: it doesn't handle fractional numbers x.xx , just integers - anything after the decimal gets dropped
|
# Limitation: it doesn't handle fractional numbers x.xx , just integers - anything after the decimal gets dropped
|
||||||
# so don't try to display π (pi) with it ;-)
|
# so don't try to display π (pi) with it ;-)
|
||||||
|
|
||||||
|
# this appears to work somewhat with fractionals but is not bash-internal:
|
||||||
|
#$ echo 1232323.1415927 | awk '{printf(fmt,$1)}' fmt="%'19.19f\n"
|
||||||
|
#1,232,323.1415927000343799591
|
||||||
|
Loading…
x
Reference in New Issue
Block a user