*** empty log message ***
authorFrancois Fleuret <francois@fleuret.org>
Wed, 11 Mar 2009 19:56:03 +0000 (20:56 +0100)
committerFrancois Fleuret <francois@fleuret.org>
Wed, 11 Mar 2009 19:56:03 +0000 (20:56 +0100)
smarthist.sh [new file with mode: 0755]

diff --git a/smarthist.sh b/smarthist.sh
new file mode 100755 (executable)
index 0000000..7b9967f
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+##################################################################
+# START_IP_HEADER                                                #
+#                                                                #
+# Written by Francois Fleuret                                    #
+# Contact <francois.fleuret@idiap.ch> 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}