200426.5 · 481b64a667e8d9aca522a0455a00f32dac1f4977
initial commit of ~/bin
This brings over everything that was in my bin-only repository.
I removed scripts that were unused or were no longer understood. I also moved any work-specific scripts to a separate (private) repository.
reading declarations
Changes to bin/overwrite. All files
@@ -0,0 +1,25 @@+#!/bin/sh+# overwrite: copy standard input to output after EOF+# (final version)++# set -x++case $# in+0|1) echo 'Usage: overwrite file cmd [args]' 1>&2; exit 2+esac++file=$1; shift+new=/tmp/$$.new; old=/tmp/$$.old+trap 'rm -f $new $old; exit 1' 1 2 15 # clean up files++if "$@" >$new # collect input+then+ cp $file $old # save original file+ trap 'trap "" 1 2 15; cp $old $file # ignore signals+ rm -f $new $old; exit 1' 1 2 15 # during restore+ cp $new $file+else+ echo "overwrite: $1 failed, $file unchanged" 1>&2+ exit 1+fi+rm -f $new $old