From 6a2f098e72e71437154ec00506e8e736aa8e1026 Mon Sep 17 00:00:00 2001 From: Soccera1 <129828376+Soccera1@users.noreply.github.com> Date: Tue, 28 Jul 2026 15:54:54 +1000 Subject: Add docs --- man/test.1 | 191 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 man/test.1 (limited to 'man/test.1') diff --git a/man/test.1 b/man/test.1 new file mode 100644 index 0000000..2a82aec --- /dev/null +++ b/man/test.1 @@ -0,0 +1,191 @@ +.\" Adapted for BNU from the GNU Coreutils 9.11 manual page; see doc/README.md. +.TH TEST "1" "2026-07-28" "BNU 9.11" "BNU Commands" +.SH NAME +test \- check file types and compare values +.SH SYNOPSIS +.B test +.I EXPRESSION +.br +.B test +.br +.\" \& tells doclifter the brackets are literal (Bug#31803). +.B [\& +.I EXPRESSION +.B ]\& +.br +.B "[\& ]\&" +.br +.B [\& +.I OPTION +.SH DESCRIPTION +.\" This page is derived from GNU Coreutils documentation. +This page documents BNU, an independent Bun implementation compatible with +GNU Coreutils 9.11. +.PP +Exit with the status determined by EXPRESSION. +.TP +\X'tty: link https://www.gnu.org/software/coreutils/test#test--help'\fB\-\-help\fP\X'tty: link' +display this help and exit +.TP +\X'tty: link https://www.gnu.org/software/coreutils/test#test--version'\fB\-\-version\fP\X'tty: link' +output version information and exit +.PP +An omitted EXPRESSION defaults to false. Otherwise, +EXPRESSION is true or false and sets exit status. It is one of: +.TP +( EXPRESSION ) +EXPRESSION is true +.TP +! EXPRESSION +EXPRESSION is false +.TP +EXPRESSION1 \fB\-a\fR EXPRESSION2 +both EXPRESSION1 and EXPRESSION2 are true +.TP +EXPRESSION1 \fB\-o\fR EXPRESSION2 +either EXPRESSION1 or EXPRESSION2 is true +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-n'\fB\-n STRING\fP\X'tty: link' +the length of STRING is nonzero +.TP +STRING +equivalent to \fB\-n\fR STRING +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-z'\fB\-z STRING\fP\X'tty: link' +the length of STRING is zero +.TP +STRING1 = STRING2 +the strings are equal +.TP +STRING1 != STRING2 +the strings are not equal +.TP +STRING1 > STRING2 +STRING1 is greater than STRING2 in the current locale +.TP +STRING1 < STRING2 +STRING1 is less than STRING2 in the current locale +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-eq'\fBINTEGER1 \-eq INTEGER2\fP\X'tty: link' +INTEGER1 is equal to INTEGER2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ge'\fBINTEGER1 \-ge INTEGER2\fP\X'tty: link' +INTEGER1 is greater than or equal to INTEGER2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-gt'\fBINTEGER1 \-gt INTEGER2\fP\X'tty: link' +INTEGER1 is greater than INTEGER2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-le'\fBINTEGER1 \-le INTEGER2\fP\X'tty: link' +INTEGER1 is less than or equal to INTEGER2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-lt'\fBINTEGER1 \-lt INTEGER2\fP\X'tty: link' +INTEGER1 is less than INTEGER2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ne'\fBINTEGER1 \-ne INTEGER2\fP\X'tty: link' +INTEGER1 is not equal to INTEGER2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ef'\fBFILE1 \-ef FILE2\fP\X'tty: link' +FILE1 and FILE2 have the same device and inode numbers +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-nt'\fBFILE1 \-nt FILE2\fP\X'tty: link' +FILE1 is newer (modification date) than FILE2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-ot'\fBFILE1 \-ot FILE2\fP\X'tty: link' +FILE1 is older than FILE2 +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-b'\fB\-b FILE\fP\X'tty: link' +FILE exists and is block special +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-c'\fB\-c FILE\fP\X'tty: link' +FILE exists and is character special +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-d'\fB\-d FILE\fP\X'tty: link' +FILE exists and is a directory +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-e'\fB\-e FILE\fP\X'tty: link' +FILE exists +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-f'\fB\-f FILE\fP\X'tty: link' +FILE exists and is a regular file +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-g'\fB\-g FILE\fP\X'tty: link' +FILE exists and is set\-group\-ID +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-G'\fB\-G FILE\fP\X'tty: link' +FILE exists and is owned by the effective group ID +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-h'\fB\-h FILE\fP\X'tty: link' +FILE exists and is a symbolic link (same as \fB\-L\fR) +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-k'\fB\-k FILE\fP\X'tty: link' +FILE exists and has its sticky bit set +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-L'\fB\-L FILE\fP\X'tty: link' +FILE exists and is a symbolic link (same as \fB\-h\fR) +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-N'\fB\-N FILE\fP\X'tty: link' +FILE exists and has been modified since it was last read +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-O'\fB\-O FILE\fP\X'tty: link' +FILE exists and is owned by the effective user ID +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-p'\fB\-p FILE\fP\X'tty: link' +FILE exists and is a named pipe +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-r'\fB\-r FILE\fP\X'tty: link' +FILE exists and the user has read access +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-s'\fB\-s FILE\fP\X'tty: link' +FILE exists and has a size greater than zero +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-S'\fB\-S FILE\fP\X'tty: link' +FILE exists and is a socket +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-t'\fB\-t FD\fP\X'tty: link' +file descriptor FD is opened on a terminal +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-u'\fB\-u FILE\fP\X'tty: link' +FILE exists and its set\-user\-ID bit is set +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-w'\fB\-w FILE\fP\X'tty: link' +FILE exists and the user has write access +.TP +\X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#test-x'\fB\-x FILE\fP\X'tty: link' +FILE exists and the user has execute (or search) access +.PP +Except for \fB\-h\fR and \fB\-L\fR, all FILE\-related tests dereference symbolic links. +Beware that parentheses need to be escaped (e.g., by backslashes) for shells. +INTEGER may also be \fB\-l\fR STRING, which evaluates to the length of STRING. +.PP +Binary \fB\-a\fR and \fB\-o\fR are ambiguous. Use 'test EXPR1 && test EXPR2' +or 'test EXPR1 || test EXPR2' instead. +.PP +\&'[' honors \fB\-\-help\fR and \fB\-\-version\fR, but 'test' treats them as STRINGs. +.PP +Your shell may have its own version of test and/or [, which usually supersedes +the version described here. Please refer to your shell's documentation +for details about the options it supports. +.SH AUTHORS +Upstream GNU Coreutils documentation authors: +Written by Kevin Braunsdorf and Matthew Bradburn. +.br +Adapted for BNU; the BNU implementation is independent. +.SH "REPORTING BUGS" +Report BNU bugs at . +.br +For upstream GNU Coreutils, see . +.SH COPYRIGHT +Copyright \(co 2026 Free Software Foundation, Inc. +.br +This manual page was adapted for BNU in 2026. +License GPLv3+: GNU GPL version 3 or later . +.br +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +.SH "SEE ALSO" +\fBaccess\fP(2) +.PP +.br +Upstream documentation +.br +BNU documentation is available locally via: info \(aq(bnu) test invocation\(aq -- cgit v1.3