GOTO(1) - Manuals

GOTO(1) General Commands Manual GOTO(1)

goto - transfer command

goto label [...]

Goto is allowed only when the shell is taking commands from a seekable command file (see lseek(2)).

The entire command file is searched for a line beginning with a : as the first non-blank character, followed by one or more blanks, and then the label. If such a line is found, goto repositions the command-file offset to the line after the label and exits. This causes the shell to transfer to the labelled line.

: is a special command which causes the shell to do nothing.

The goto command exits with one of the following values:
The label was found.
The label was not found.
An error was detected.

if(1), etsh(1), tsh(1)

Etsh home page:

The goto command from Version 6 (V6) UNIX requires : to be the first character on the labelled line. Otherwise, the label cannot be found.

This port differs in that : may be preceded by blanks. This allows labelled lines to be indented so that complex command files might be easier to read and understand.

A goto command appeared as /bin/goto in Version 3 (V3) UNIX.

This port of the goto command is derived from Version 6 (V6) UNIX /usr/source/s1/goto.c. It was written by Ken Thompson of Bell Labs. Jeffrey Allen Neitzel <> ported and maintains it as goto(1).

See either the LICENSE file which is distributed with etsh or for full details.
March 28, 2019 etsh-5.4.0

UNIX® is a registered trademark of
The Open Group.

Copyright © 2003-2019 .
All rights reserved. Contact