shithub: 9utils

ref: 4e4a6d321cde14dc730f9e8a80b7ab94238ff616
dir: /util/savehist/

View raw version
#!/bin/rc
# savehist - prune and save command history
# usage: savehist

rfork ne
temp=/tmp/quit-$pid
hist=$home/lib/text
touch $hist
#sigexit{ rm -f $temp }

grep 'term% ' /dev/text > $temp
cat $temp $hist | sort | uniq > /tmp/TMP-$pid
mv /tmp/TMP-$pid $hist
rm -f $temp