PDA

View Full Version : Why the "!" history feature doesn't work in knoppi



maxIT
07-06-2006, 06:39 AM
According to man_history '! Start a history substitution...', but to me it return an error message:
bash: syntax error near unexpected token `newline'

The same behavior also in 'debian sarge' I've noticed.

malaire
07-06-2006, 09:42 AM
According to man_history '! Start a history substitution...', but to me it return an error message:
bash: syntax error near unexpected token `newline'
The same behavior also in 'debian sarge' I've noticed.

Did you try to use plain "!"?
That is incorrect usage because man history clearly says that "!" only starts a history substitution when not followed by a blank, newline, = or (


! Start a history substitution, except when followed by a blank, newline, = or (.
!n Refer to command line n.
!-n Refer to the current command line minus n.
!! Refer to the previous command. This is a synonym for `!-1'.

At least on Knoppix 4.0.2 CD history expansion works as expected:


knoppix@0[knoppix]$ echo One
One
knoppix@0[knoppix]$ echo Two
Two
knoppix@0[knoppix]$ !
bash: syntax error near unexpected token `newline'
knoppix@0[knoppix]$ !-2
echo Two
Two
knoppix@0[knoppix]$ !-4
echo One
One
knoppix@0[knoppix]$ !!
echo One
One

maxIT
07-06-2006, 10:55 AM
:oops: Oh me stupid! Thanks!
Maybe I was confused after reading somewere on the net something like: "type ! to repeat the last bash command"