~nabijaczleweli/voreutils

ref: cb91cf21c628ab3d5e42d89694d99fcca6c8efc8 voreutils/tests/true -rwxr-xr-x 707 bytes
cb91cf21наб Add uname (and arch). Centralise spaced print 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# SPDX-License-Identifier: 0BSD

tmpdir="$(mktemp -dt "true.XXXXXXXXXX")/"
true="${CMDDIR}true"

altname="${tmpdir%/}"
altname="${altname##*/}"

ln -fs "$true" "${tmpdir}true"
ln -fs "$true" "${tmpdir}false"
ln -fs "$true" "${tmpdir}something-else"
ln -fs "$true" "${tmpdir}$altname"

"${tmpdir}true"; err=$?
[ $err -eq 0 ] || echo "true: got $err instead of 0 for true" >&3
"${tmpdir}false"; err=$?
[ $err -eq 1 ] || echo "true: got $err instead of 1 for false" >&3
"${tmpdir}something-else"; err=$?
[ $err -eq 2 ] || echo "true: got $err instead of 2 for something-else" >&3
"${tmpdir}$altname"; err=$?
[ $err -eq 2 ] || echo "true: got $err instead of 2 for $altname" >&3

rm -rf "$tmpdir" >&3