Fix that REPL crashes in shell mode on $a<tab> and added a test.