From: Francois Fleuret Date: Wed, 11 Mar 2009 19:56:03 +0000 (+0100) Subject: *** empty log message *** X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6ca9f58d1fc293f319a78b208675a6a8b54c30f;p=selector.git *** empty log message *** --- diff --git a/smarthist.sh b/smarthist.sh new file mode 100755 index 0000000..7b9967f --- /dev/null +++ b/smarthist.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +################################################################## +# START_IP_HEADER # +# # +# Written by Francois Fleuret # +# Contact for comments & bug reports # +# # +# END_IP_HEADER # +################################################################## + +# You can add in your ~/.inputrc something like +# Control-h: "smarthist.sh\n" +# so that C-h will invoke this script + +EXE=./selector + +# We do not want a security breach + +OUT=/tmp/selector.out +touch ${OUT} +chmod go-rwx ${OUT} + +${EXE} ~/.bash_history + +# We set the echo off + +OLD_SETTINGS=`stty -g` +stty -echo raw + +# Put the line we got into the tty buffer + +writevt `tty` "`cat ${OUT}`" + +# Set back the echo as it was + +stty ${OLD_SETTINGS} + +# Remove the file containing what we got from the selector + +\rm ${OUT}