tsort - Sort files topologically

Format

tsort [file]

Description

tsort reads input from files (or from the standard input if you do not specify a file) and produces an ordered list of items consistent with a partial ordering of items provided by the input.

Input to tsort takes the form of pairs of items (nonempty strings) separated by blanks. A pair of two different items indicates ordering. A pair of identical items indicates presence, but not ordering.

Examples

The command:
tsort <<EOF
a b c c d e
g g
f g e f
h h
EOF
produces the output:
a
b
c
d
e
f
g
h

Localization

tsort uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_MESSAGES
  • NLSPATH

Exit values

0
Successful completion.
>0
An error occurred.

Portability

POSIX.2, X/Open Portability GuideX/Open Portability Guide.