cmp.t (833B)
- #!/usr/bin/env cram
- # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- $ export PATH="$TESTDIR/../cmd:$PATH"
- $ test "$(command -v cmp)" = "$TESTDIR/../cmd/cmp"
- $ printf 'foo' > foo
- $ printf 'bar' > bar
- $ cmp foo foo
- $ cmp bar bar
- $ cmp foo bar
- foo bar differ: char 1, line 1
- [1]
- $ cmp -s foo bar
- [1]
- $ cmp bar foo
- bar foo differ: char 1, line 1
- [1]
- $ cmp -s bar foo
- [1]
- $ seq 1 3 > foo
- $ seq 1 2 > bar
- $ cmp foo bar
- cmp: EOF on bar line 3
- [1]
- $ cmp -s foo bar
- [1]
- $ echo '3 different' > bar
- $ cmp foo bar
- foo bar differ: char 1, line 1
- [1]
- $ cmp -s foo bar
- [1]
- $ seq 1 3 > foo
- $ seq 1 2 > bar
- $ cmp -l foo bar
- cmp: EOF on bar line 3
- [1]
- $ cmp -n 4 foo bar
- $ rm foo bar
- $ find .
- .