Mercurial > hg > cc > cirrus_home
changeset 153:2b59f3ef2294
add -c switch to btot
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Mon, 01 Nov 2021 21:23:13 +0000 |
parents | 0072e4ee6c67 |
children | 2643a6825f17 |
files | .bashrc |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/.bashrc Thu Oct 28 12:11:08 2021 +0000 +++ b/.bashrc Mon Nov 01 21:23:13 2021 +0000 @@ -89,14 +89,21 @@ btot () { python3 -c 'import sys +commas = False +if len(sys.argv)>1: + if sys.argv[1]=="-c": + commas = True n=0 for l in sys.stdin: try: n+=int(l) except ValueError as e: print(e,file=sys.stderr) -print(n) -' +if commas: + print(f"{n:,}") +else: + print(n) +' "$@" } function uz () { $G/usr/bin/igzip -dc "$@" ; }