If you like BoxMatrix then please contribute Supportdata, Supportdata2, Firmware and/or Hardware (get in touch).
My metamonk@yahoo.com is not reachable by me since years. Please use hippie2000@webnmail.de instead.

0
U

Property:test (bashcmd)

From BoxMatrix


BoxMatrix >> Shell-Commands >> test (bashcmd) @ BoxMatrix   -   IRC-Chat   -   Translate: de es fr it nl pl
News Selectors Models Accessories Components Environment Config Commands System Webif Software Develop Lexicon Community Project Media

Startup-Scr Hotplug-Scr BusyBox-Cmds Bash-Cmds AVM-Cmds Chipset-Cmds Linux-Cmds Shared-Libs Kernel-Mods Research

Info
  
Name-Collision - multiple objects in this wiki use the name test!
test (bashcmd) Evaluate conditional expression.
test (bbcmd) Check file types, compare values etc.

Bash-Command

Goto:   GPL-Browser  -  Dependencies   -   Model-Matrix   -   Symbols   -   SMW-Browser

Details

Excerpt from:   Bash source   >>   test command

Possible #if / #endif blocks are compile options. There is no mechanism yet on BoxMatrix to detect which of these are set per model.

test [expr]

Evaluate conditional expression.

Exits with a status of 0 (true) or 1 (false) depending on
the evaluation of EXPR.  Expressions may be unary or binary.  Unary
expressions are often used to examine the status of a file.  There
are string operators and numeric comparison operators as well.

The behavior of test depends on the number of arguments.  Read the
bash manual page for the complete specification.

File operators:

  -a FILE        True if file exists.
  -b FILE        True if file is block special.
  -c FILE        True if file is character special.
  -d FILE        True if file is a directory.
  -e FILE        True if file exists.
  -f FILE        True if file exists and is a regular file.
  -g FILE        True if file is set-group-id.
  -h FILE        True if file is a symbolic link.
  -L FILE        True if file is a symbolic link.
  -k FILE        True if file has its `sticky' bit set.
  -p FILE        True if file is a named pipe.
  -r FILE        True if file is readable by you.
  -s FILE        True if file exists and is not empty.
  -S FILE        True if file is a socket.
  -t FD          True if FD is opened on a terminal.
  -u FILE        True if the file is set-user-id.
  -w FILE        True if the file is writable by you.
  -x FILE        True if the file is executable by you.
  -O FILE        True if the file is effectively owned by you.
  -G FILE        True if the file is effectively owned by your group.
  -N FILE        True if the file has been modified since it was last read.

  FILE1 -nt FILE2  True if file1 is newer than file2 (according to
                   modification date).

  FILE1 -ot FILE2  True if file1 is older than file2.

  FILE1 -ef FILE2  True if file1 is a hard link to file2.

String operators:

  -z STRING      True if string is empty.

  -n STRING
     STRING      True if string is not empty.

  STRING1 = STRING2
                 True if the strings are equal.
  STRING1 != STRING2
                 True if the strings are not equal.
  STRING1 < STRING2
                 True if STRING1 sorts before STRING2 lexicographically.
  STRING1 > STRING2
                 True if STRING1 sorts after STRING2 lexicographically.

Other operators:

  -o OPTION      True if the shell option OPTION is enabled.
  -v VAR         True if the shell variable VAR is set.
  -R VAR         True if the shell variable VAR is set and is a name
                 reference.
  ! EXPR         True if expr is false.
  EXPR1 -a EXPR2 True if both expr1 AND expr2 are true.
  EXPR1 -o EXPR2 True if either expr1 OR expr2 is true.

  arg1 OP arg2   Arithmetic tests.  OP is one of -eq, -ne,
                 -lt, -le, -gt, or -ge.

Arithmetic binary operators return true if ARG1 is equal, not-equal,
less-than, less-than-or-equal, greater-than, or greater-than-or-equal
than ARG2.

Exit Status:
Returns success if EXPR evaluates to true; fails if EXPR evaluates to
false or an invalid argument is given.

Excerpt from:   bashref.info   >>   Bourne Shell Builtins   >>   test command

test EXPR

Evaluate a conditional expression EXPR and return a status of 0
(true) or 1 (false).  Each operator and operand must be a separate
argument.  Expressions are composed of the primaries described
below in *note Bash Conditional Expressions::.  'test' does not
accept any options, nor does it accept and ignore an argument of
'--' as signifying the end of options.

When the '[' form is used, the last argument to the command must be
a ']'.

Expressions may be combined using the following operators, listed
in decreasing order of precedence.  The evaluation depends on the
number of arguments; see below.  Operator precedence is used when
there are five or more arguments.

! EXPR
     True if EXPR is false.

( EXPR )
     Returns the value of EXPR.  This may be used to override the
     normal precedence of operators.

EXPR1 -a EXPR2
     True if both EXPR1 and EXPR2 are true.

EXPR1 -o EXPR2
     True if either EXPR1 or EXPR2 is true.

The 'test' and '[' builtins evaluate conditional expressions using
a set of rules based on the number of arguments.

0 arguments
     The expression is false.

1 argument
     The expression is true if and only if the argument is not
     null.

2 arguments
     If the first argument is '!', the expression is true if and
     only if the second argument is null.  If the first argument is
     one of the unary conditional operators (*note Bash Conditional
     Expressions::), the expression is true if the unary test is
     true.  If the first argument is not a valid unary operator,
     the expression is false.

3 arguments
     The following conditions are applied in the order listed.  If
     the second argument is one of the binary conditional operators
     (*note Bash Conditional Expressions::), the result of the
     expression is the result of the binary test using the first
     and third arguments as operands.  The '-a' and '-o' operators
     are considered binary operators when there are three
     arguments.  If the first argument is '!', the value is the
     negation of the two-argument test using the second and third
     arguments.  If the first argument is exactly '(' and the third
     argument is exactly ')', the result is the one-argument test
     of the second argument.  Otherwise, the expression is false.

4 arguments
     If the first argument is '!', the result is the negation of
     the three-argument expression composed of the remaining
     arguments.  Otherwise, the expression is parsed and evaluated
     according to precedence using the rules listed above.

5 or more arguments
     The expression is parsed and evaluated according to precedence
     using the rules listed above.

When used with 'test' or '[', the '<' and '>' operators sort
lexicographically using ASCII ordering.

Excerpt from:   bashref.info   >>   Bash Conditional Expressions   >>   test command

Bash Conditional Expressions

Conditional expressions are used by the '[[' compound command and the
'test' and '[' builtin commands.

Expressions may be unary or binary.  Unary expressions are often used
to examine the status of a file.  There are string operators and numeric
comparison operators as well.  Bash handles several filenames specially
when they are used in expressions.  If the operating system on which
Bash is running provides these special files, Bash will use them;
otherwise it will emulate them internally with this behavior: If the
FILE argument to one of the primaries is of the form '/dev/fd/N', then
file descriptor N is checked.  If the FILE argument to one of the
primaries is one of '/dev/stdin', '/dev/stdout', or '/dev/stderr', file
descriptor 0, 1, or 2, respectively, is checked.

When used with '[[', the '<' and '>' operators sort lexicographically
using the current locale.  The 'test' command uses ASCII ordering.

Unless otherwise specified, primaries that operate on files follow
symbolic links and operate on the target of the link, rather than the
link itself.

-a FILE
  True if FILE exists.

-b FILE
  True if FILE exists and is a block special file.

-c FILE
  True if FILE exists and is a character special file.

-d FILE
  True if FILE exists and is a directory.

-e FILE
  True if FILE exists.

-f FILE
  True if FILE exists and is a regular file.

-g FILE
  True if FILE exists and its set-group-id bit is set.

-h FILE
  True if FILE exists and is a symbolic link.

-k FILE
  True if FILE exists and its 'sticky' bit is set.

-p FILE
  True if FILE exists and is a named pipe (FIFO).

-r FILE
  True if FILE exists and is readable.

-s FILE
  True if FILE exists and has a size greater than zero.

-t FD
  True if file descriptor FD is open and refers to a terminal.

-u FILE
  True if FILE exists and its set-user-id bit is set.

-w FILE
  True if FILE exists and is writable.

-x FILE
  True if FILE exists and is executable.

-G FILE
  True if FILE exists and is owned by the effective group id.

-L FILE
  True if FILE exists and is a symbolic link.

-N FILE
  True if FILE exists and has been modified since it was last read.

-O FILE
  True if FILE exists and is owned by the effective user id.

-S FILE
  True if FILE exists and is a socket.

FILE1 -ef FILE2
  True if FILE1 and FILE2 refer to the same device and inode numbers.

FILE1 -nt FILE2
  True if FILE1 is newer (according to modification date) than FILE2,
  or if FILE1 exists and FILE2 does not.

FILE1 -ot FILE2
  True if FILE1 is older than FILE2, or if FILE2 exists and FILE1
  does not.

-o OPTNAME
  True if the shell option OPTNAME is enabled.  The list of options
  appears in the description of the '-o' option to the 'set' builtin
  (*note The Set Builtin::).

-v VARNAME
  True if the shell variable VARNAME is set (has been assigned a
  value).

-R VARNAME
  True if the shell variable VARNAME is set and is a name reference.

-z STRING
  True if the length of STRING is zero.

-n STRING
STRING
  True if the length of STRING is non-zero.

STRING1 == STRING2
STRING1 = STRING2
  True if the strings are equal.  When used with the '[[' command,
  this performs pattern matching as described above (*note
  Conditional Constructs::).

  '=' should be used with the 'test' command for POSIX conformance.

STRING1 != STRING2
  True if the strings are not equal.

STRING1 < STRING2
  True if STRING1 sorts before STRING2 lexicographically.

STRING1 > STRING2
  True if STRING1 sorts after STRING2 lexicographically.

ARG1 OP ARG2
  'OP' is one of '-eq', '-ne', '-lt', '-le', '-gt', or '-ge'.  These
  arithmetic binary operators return true if ARG1 is equal to, not
  equal to, less than, less than or equal to, greater than, or
  greater than or equal to ARG2, respectively.  ARG1 and ARG2 may be
  positive or negative integers.

GPL-Browser

Daily updated index of all test code findings on the GPL-Browser. Last update: 2024-11-14 05:08 GMT.
The Browse column points to the Path containing the respective source code on the gpl.boxmatrix.info service.
The SoC column lists the Chip-Codenames, the Model column lists the nicks of the Box-Models.
The Diff column links the comparison of the AVM Kernel to the pristine original from Kernel.org.
The Download column links the full tarball the respective directory content is extracted from.
The presence of the source does not mean it fits the respective model and architecture. See the Model-Matrix where it's used.

Dependencies

Daily updated index of all dependencies of this command. Last update: 2024-11-14 07:42 GMT.
A * in the Mod column marks info from Supportdata-Probes, which will always stay incomplete.

Relation Typ Object Mod Firmware Info Origin
0 dependencies for this command

Model-Matrix

Daily updated index of the presence, path and size of this command for each model. Last update: 2024-11-14 05:49 GMT.
Showing all models using this command. Click any column header (click-wait-click) to sort the list by the respective data.
The (main/scrpn/boot/arm/prx/atom/rtl) label in the Model column shows which CPU is meant for Multi-Linux models.
Note that this list is merged from Firmware-Probes of all known AVM firmware for a model, including Recovery.exe and Labor-Files.

Model Firmware Path Size
FRITZ!Box 6591 Cable (atom) 7.04 - 8.00 <bash>
FRITZ!Box 6660 Cable (atom) 7.14 - 8.00 <bash>
FRITZ!Box 6670 Cable (atom) 7.61 - 7.90 <bash>
FRITZ!Box 6690 Cable (atom) 7.28 - 7.90 <bash>
4 models use this command

Symbols

Daily updated index of all symbols of this command. Last update: 2024-11-14 07:42 GMT.

Firmware Symbol
0 symbols for this command

SMW-Browser

Information is currently being retrieved from the backend.