Mercurial > hg > cc > cirrus_home
view .bash_extras @ 184:53a8ffe06460
use csing, and _runme_c.sh to get it initialised
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Fri, 08 Sep 2023 21:44:48 +0100 |
parents | cac9586291ad |
children | acae526510e2 |
line wrap: on
line source
# Sourced by .bashrc cu () { cvs update "$@" | egrep -v '^\?' } lss () { /bin/ls -l "$@" | sort -nr -k 5 } ff () { pat=$1; shift; find . -iname "*$pat*" $@ } typecat () { tt=$(type $1); case $tt in *\ is\ hashed\ *) cat $(echo $tt | cut -f 4 -d ' ' | tr -d '()') ;; *\ is\ /*) cat $(echo $tt | cut -f 3 -d ' ' | tr -d '()') ;; *) type $1 ;; esac } sus () { sort "$@" | uniq -c | sort -k1nr,1 } uz () { igzip -dc "$@" } function typecat () { tt=$(type $1) case $tt in *\ is\ hashed\ *) cat $(echo $tt | cut -f 4 -d ' ' | tr -d '()') ;; *\ is\ /*) cat $(echo $tt | cut -f 3 -d ' ' | tr -d '()') ;; *) type $1 ;; esac } function tot () { awk '{sum+=$1} END {printf "%u\n",sum}' } 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) if commas: print(f"{n:,}") else: print(n) ' "$@" } export -f cu lss ff typecat sus uz tot btot