1

Where is the manual for Ubuntu's break -command?

I run

~ master $ man break
No manual entry for break
~ master $ break
break: not in while, until, select, or repeat loop
~ master $ 

Without manual it is difficult to understand the purpose of the command. It may be linked to the for -loops of the C -codes of the kernel. I do not believe that it is the break for Bash.

2
  • 2
    break is a bash builtin, not a command. Type help break at the prompt. Dec 3, 2009 at 0:58
  • Also try type -a break at the prompt. Dec 3, 2009 at 4:34

4 Answers 4

5

For Bash:

$ help break
break: break [n]
    Exit for, while, or until loops.

    Exit a FOR, WHILE or UNTIL loop.  If N is specified, break N enclosing
    loops.

    Exit Status:
    The exit status is 0 unless N is not greater than or equal to 1.

The error message you are seeing is issued by Bash. What is the context in which you are trying to understand "break"?

In C, break is a keyword. See this wikibook for more information. In part, it says:

A break statement will immediately exit the enclosing loop.

1
  • An answer that addresses the question! Yeah! Dec 3, 2009 at 0:57
1

If I got your question right, what you are after is:

man bash

alternatively you can also issue:

man bash | grep -C5 "break [n]"

EDIT: Sorry, I missed your note about not being the bash break. :-| However I can't reproduce the error message you get. I get instead:

bash: break: only meaningful in a `for', `while', or `until' loop

What version of ubuntu do you use? What version of bash? Mine is version 4.0.33(1)-release (x86_64-pc-linux-gnu)... I am asking just in case the two different messages are both from bash but from different versions...

What does

which break

output to you? If it is a standalone program you will get the directory where the executable is located and thus probably be able to understand what installation is part of. If it is a bash (ot other shell) command it will silently fail (no output).

2
  • I use Ubuntu 9.10 Dec 2, 2009 at 21:30
  • I use Ubuntu 9.10 too (64 bit) so it does look like it is another program, indeed.
    – mac
    Dec 2, 2009 at 21:33
1

A googling came up with this link, suggesting that the break command you've come across is indeed not from bash; it's from zsh. Hence you should be able to get the correct manual by issuing man zshbuiltins.

1
0

i also have an ubuntu 9.10 installation. if if issue:

media@faun:~$ break
-bash: break: only meaningful in a `for', `while', or `until' loop
media@faun:~$

you see that this output definitely comes from bash. if you issue

media@faun:~$ su -
media@faun:~$ find / -name "break"

and

media@faun:~$ which break
media@faun:~$ type break

you see that there is no other binary and that break is bash builtin. the manual to break is in the manual for bash.

media@faun:~$ man bash

the error message you get is indeed from using the builtin break in a situation it doesn't work. you can try it like this:

media@faun:~$ for i in 0 1
> do
> echo $i
> done
0
1
media@faun:~$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .