From c6ca9f58d1fc293f319a78b208675a6a8b54c30f Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Wed, 11 Mar 2009 20:56:03 +0100 Subject: [PATCH] *** empty log message *** --- smarthist.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 smarthist.sh 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} -- 2.20.1