Sign up ×
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 add to ~/.bashrc the following code:

test_exclamation () {
  printf %s "$READLINE_LINE" | xargs echo
bind -x '"\eX": test_exclamation'

I write to bash prompt buffer

$ !1700

If I press Enter, then command with number 1700 from history performs. If I press Shift+Alt+X, I got an output:


How to change test_exclamation function to print command under number 1700?

share|improve this question
How is $READLINE_LINE defined? –  Ketan Feb 10 '14 at 15:45
@Ketan - This is an built in BASH variable. Have a look at… –  Loom Feb 10 '14 at 19:25

1 Answer 1

up vote 2 down vote accepted

Change it to

test_exclamation () {   READLINE_LINE=$( history -p "$READLINE_LINE" ) ;  }
share|improve this answer

Your Answer


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.