Phil Endecott wrote: > Dear Bash and Readline Experts, > > I have a simple shell script that reads user commands in a loop using > "read -e". -e enables readline, but not its history feature. Is there > any way to get readline history with bash's read builtin?
Sure. You can do it entirely with bash builtins and shell variables. > I wouldn't want to get the user's regular bash history; rather, this > program would need its own history file in the user's home directory. > For example: > > read -e --historyfile=~/.myprogname_history CMD HISTFILE=~/.myprogram_history history -r (The `history -r' is needed if you'd like history to persist across program invocations.) To save the lines read to the history list, use `history -s': read -e CMD [ -n "$CMD" ] && history -s "$CMD" If at the end of the script you'd like to save the history to the history file, use `history -w' or `history -a'. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/