Changed from shell [ ] operator to bash [[ ]] operator.
Added readline support.