-2

I'm trying to get CTRL + L to work under solaris 10,

So I tried to add a binding to ~/.inputrc

"\C-l":'clear\n' 

Well it did bind to the clear command, but clear command itself fails, sigh.

Any ideas?

P.S I've tried to set TERM variable to linux or xterm, which does not help.

enter image description here

EDIT

Instead of modifying inputrc, looks like I should do

export TERM=xterm 

Solaris simply does not work with xterm-256color, which is set by iTerm2 by default.

3
  • 1
    Does printf '\033\143' clear your screen? Commented Dec 19, 2016 at 7:17
  • 1
    Sorry for the delay. For bash: echo $'"\C-l": "printf \'\\033c\'\015"' >> ~/.inputrc, then ctrl-x ctrl-r to re-read ~/.inputrc, then try ctrl-l. Commented Dec 19, 2016 at 8:05
  • bash ignores a missing terminal description; clear doesn't. Commented Dec 20, 2016 at 0:25

1 Answer 1

3

You should try to bind it like this:

"\C-l":clear-screen 

That did work at least for me on my CentOS 7 test machine. Unfortunately I could not find any manual reference for this now, but there is this mentioned on bash man page:

 clear-screen (C-l) Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line without clearing the screen. 
4
  • Hmm, no effect on solaris. I've logged out and logged in again to confirm that. Commented Dec 19, 2016 at 7:16
  • 3
    Nonetheless, this is the right thing to do and the other answer is just a bodge. Given that the clear command doesn't clear the screen, the problem that you have is some sort of terminfo problem. That is what you need to fix, leaving the readline configuration with the normal binding, as given here. Unfortunately, you haven't shown answerers the important stuff: what terminal type you are using, what terminal emulator program you are using, and a syscall trace (or hex dump of the of the output) of the clear command. Hence answers that don't address terminfo at all. Commented Dec 19, 2016 at 8:49
  • @JdeBP so how to fix the terminfo? Commented Dec 20, 2016 at 0:12
  • @JdeBP never mind, setting TERM to xterm fixed the problem, no additional binding required Commented Dec 20, 2016 at 0:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.