Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to create a bind that executes g++ !$ in the same way that the shell would interpret it if I just typed it.

I tried:

  • bind '"\ee": "g++ !$"', but it doesn't execute command (just "pastes" it)
  • bind -x '"\ee": "g++ !$"', but it doesn't interpret the !$ part correctly

Any way to overcome it without using some custom shell scripts?

share|improve this question
    
I am not sure, but you can try escaping the bang and/or the dollar like bind -x '"\ee": "g++ \!\$"' . Does it work? –  Sudhi Mar 10 '13 at 12:08
    
No, it doesn't. –  REACHUS Mar 10 '13 at 12:15

1 Answer 1

up vote 0 down vote accepted

bind '"\ee": "g++ !$"' does exactly what you wrote, which is to insert g++ !$ on the command line. If you want the command to be executed, you need to press Enter.

bind '"\ee": "g++ !$\r"'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.