Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know that the command say "something" in mac's terminal would make it say stuff. I am new to Unix and since OS X is UNIX based, I was trying to teach myself the commands and I read that !5 would recall the last five commands in the terminal's history. when I typed that, the terminal started saying stuff! is this supposed to happen?

share|improve this question

migrated from stackoverflow.com Dec 31 '12 at 2:01

This question came from our site for professional and enthusiast programmers.

    
Search the bash manpage for "HISTORY EXPANSION"... –  dmckee Dec 31 '12 at 1:45
    
Are you sure you didn't press Command+F5? –  Luigi R. Viggiano Dec 31 '12 at 1:47
    
Type history and see what the 5th command was. !# would run whatever # you entered (not the last five, just the fifth). So it should call whatever number. Did you run say ... as that number? –  nerdwaller Dec 31 '12 at 3:21
add comment

1 Answer

If you press !5 (bang-5) at the command line, if you are in a CSH varient....you'll cause the 5th command since the particular shell invokation was started entered to be recalled and executed as if you entered it on the command line.

Depending on what the 5th command in your particular case was, you'd be seeing the output from that command.

share|improve this answer
    
Ditto for bash(1), and I believe other shells too. –  vonbrand Jan 23 '13 at 18:51
add comment

Your Answer

 
discard

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