version 1.7.3.0
[socat.git] / readline.sh
blobfda7ea68f705c92f80a26b179bb2565161137e23
1 #! /bin/bash
2 # source: readline.sh
3 # Copyright Gerhard Rieger 2003-2004
4 # Published under the GNU General Public License V.2, see file COPYING
6 # this is an attempt for a socat based readline wrapper
7 # usage: readline.sh <command>
9 withhistfile=1
11 while true; do
12 case "X$1" in
13 X-nh|X-nohist*) withhistfile=; shift; continue ;;
14 *) break;;
15 esac
16 done
18 PROGRAM="$@"
19 if [ "$withhistfile" ]; then
20 HISTFILE="$HOME/.$1_history"
21 HISTOPT=",history=$HISTFILE"
22 else
23 HISTOPT=
25 mkdir -p /tmp/$USER || exit 1
29 exec socat -d readline"$HISTOPT",noecho='[Pp]assword:' exec:"$PROGRAM",sigint,pty,setsid,ctty,raw,echo=0,stderr 2>/tmp/$USER/stderr2