On Sat, Sep 01, 2007 at 12:11:58AM +0100, 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?
Phil, You can use "history -r" to read a file into the shell's history and "history -s" to add each line that you read into the history. Then use history -w to save the history back to the file. Here is an example with vi style readline editing. #!/bin/bash history -r script_history set -o vi CMD="" while true do echo "Type something" read -e CMD history -s "$CMD" echo "You typed $CMD" case "$CMD" in stop) break ;; history) history ;; esac done history -w script_history echo stopping -- Mike Stroyan <[EMAIL PROTECTED]>