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:
0
The label was found.
1
The label was not found.
2
An error was detected.

if(1), etsh(1), tsh(1)
Etsh home page: https://etsh.io/

The goto command from Sixth Edition (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 Third Edition UNIX.

This port of the goto command is derived from Sixth Edition (V6) UNIX /usr/source/s1/goto.c. Presumably, Ken Thompson of Bell Labs wrote it. Jeffrey Allen Neitzel <jan@etsh.io> ported and currently maintains it as goto(1).

See either the LICENSE file which is distributed with etsh or https://etsh.io/license/ for full details.
August 23, 2018 etsh-5.3.1

UNIX® is a registered trademark of
The Open Group.

Copyright © 2003-2018 .
All rights reserved. Contact