readlink.t (961B)
- #!/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 readlink)" = "$TESTDIR/../cmd/readlink"
- $ ln -s //example.org/ foobar
- $ readlink foobar
- //example.org/
- $ readlink -n foobar
- //example.org/ (no-eol)
- $ readlink
- readlink: Expected one file as argument, got 0
- Usage: readlink [-f|-e] [-n|-z] file...
- [1]
- $ readlink foo bar
- readlink: Error: Failed reading symbolic link of 'foo': No such file or directory
- [1]
- $ test ! -f enoent
- $ readlink enoent
- readlink: Error: Failed reading symbolic link of 'enoent': No such file or directory
- [1]
- $ touch regular
- $ readlink regular
- readlink: Error: Failed reading symbolic link of 'regular': Invalid argument
- [1]
- $ mkdir dir
- $ readlink dir
- readlink: Error: Failed reading symbolic link of 'dir': Invalid argument
- [1]