logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git

readlink.t (961B)


  1. #!/usr/bin/env cram
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. $ export PATH="$TESTDIR/../cmd:$PATH"
  5. $ test "$(command -v readlink)" = "$TESTDIR/../cmd/readlink"
  6. $ ln -s //example.org/ foobar
  7. $ readlink foobar
  8. //example.org/
  9. $ readlink -n foobar
  10. //example.org/ (no-eol)
  11. $ readlink
  12. readlink: Expected one file as argument, got 0
  13. Usage: readlink [-f|-e] [-n|-z] file...
  14. [1]
  15. $ readlink foo bar
  16. readlink: Error: Failed reading symbolic link of 'foo': No such file or directory
  17. [1]
  18. $ test ! -f enoent
  19. $ readlink enoent
  20. readlink: Error: Failed reading symbolic link of 'enoent': No such file or directory
  21. [1]
  22. $ touch regular
  23. $ readlink regular
  24. readlink: Error: Failed reading symbolic link of 'regular': Invalid argument
  25. [1]
  26. $ mkdir dir
  27. $ readlink dir
  28. readlink: Error: Failed reading symbolic link of 'dir': Invalid argument
  29. [1]