comparison .bashrc @ 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 53006db54871
children cac9586291ad
comparison
equal deleted inserted replaced
152:0072e4ee6c67 153:2b59f3ef2294
87 } 87 }
88 88
89 btot () 89 btot ()
90 { 90 {
91 python3 -c 'import sys 91 python3 -c 'import sys
92 commas = False
93 if len(sys.argv)>1:
94 if sys.argv[1]=="-c":
95 commas = True
92 n=0 96 n=0
93 for l in sys.stdin: 97 for l in sys.stdin:
94 try: 98 try:
95 n+=int(l) 99 n+=int(l)
96 except ValueError as e: 100 except ValueError as e:
97 print(e,file=sys.stderr) 101 print(e,file=sys.stderr)
98 print(n) 102 if commas:
99 ' 103 print(f"{n:,}")
104 else:
105 print(n)
106 ' "$@"
100 } 107 }
101 108
102 function uz () { $G/usr/bin/igzip -dc "$@" ; } 109 function uz () { $G/usr/bin/igzip -dc "$@" ; }
103 110
104 function typecat () 111 function typecat ()