Over a million developers have joined DZone.

Get Input From Terminal With Prompt, History, Line Editor

Using this script you will be able to read user input using readline goodies but without need to manually program readline library. Just save it under e.g. /usr/local/bin/getline, and then call like:
getline {prompt} {historydir}.

for example:
getline "input> " "/tmp"

You can for example call this script from php using popen(). This way php doesn't have to include readline module, and you can do shell stuff not inside php, but using shell code, which is more natural and comfortable way to do it.

#!/bin/bash -f
history -r "$2/.getline_history"
read -re -p "$1" LINE
history -s "$LINE"
history -w "$2/.getline_history"
echo $LINE


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}