Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arrow keys not working in shell

I'm getting started with a Laravel 5 project and trying to run some experiments using 'php artisan tinker' (psy shell), but I'm running into some weirdness. In the tinker/psy shell, pressing any of the arrow keys is printing character literals to the screen rather than performing the intended behaviour (move character for left and right, cycle recent commands for up and down).

Up is outputting ^[[A. Down is outputting ^[[B. Right is outputting ^[[C. Left is outputting ^[[D.

This is probably an issue with my terminal and not a Laravel bug. I am getting the same buggy behaviour when running php -a.

I am running terminal on OSX, with an xterm emulation.

like image 522
Sean Fraser Avatar asked Feb 26 '15 03:02

Sean Fraser


1 Answers

MY os: centos I solved the problem by :

sudo yum install rlwrap
alias tinker='rlwrap php artisan tinker'

like image 121
hook zou Avatar answered Sep 29 '22 09:09

hook zou