4 # selector is a simple shell command for selection of strings with a
5 # dynamic pattern-matching.
7 # Copyright (c) 2009 Francois Fleuret
8 # Written by Francois Fleuret <francois.fleuret@idiap.ch>
10 # This file is part of selector.
12 # selector is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License version 3 as
14 # published by the Free Software Foundation.
16 # selector is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with selector. If not, see <http://www.gnu.org/licenses/>.
25 # You can add in your ~/.inputrc something like
26 # Control-h: "smarthist.sh\n"
27 # so that C-h will invoke this script
31 # We do not want a security breach
33 OUT=`mktemp /tmp/selector.XXXXXX`
37 ${EXE} -o ${OUT} -f ~/.bash_history
38 # ${EXE} -b -o ${OUT} -f ~/.bash_history
42 OLD_SETTINGS=`stty -g`
45 # Put the line we got into the tty buffer
47 writevt `tty` "`cat ${OUT}`"
49 # Set back the echo as it was
53 # Remove the file containing what we got from the selector