René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

test [shell]

test expression
or, alternatively and equivalently
[ expression ]

Expressions

  • -s file
    true if file exists and is not empty
  • -f file
    true if file is an ordinary file
  • -d file
    true if file is a directory
  • -r file
    true if file is readable
  • -w file
    true if file is writable
  • -x file
    true if file is executable
  • $X -eq $Y
    true if integer X equals integer Y
  • $X -ne $Y
    true if integer X not equal to integer Y
  • $X -lt $Y
    true if integer X less than Y
  • $X -gt $Y
    true if integer X greater than integer Y
  • $X -le $Y
    true if integer X less than or equal to integer Y
  • $X -ge $Y
    true if integer X greater than or equal to integer Y
  • "$A" = "$B"
    true if string A equals string B
  • "$A" != "$B"
    true if string A not equal to string B
  • $X ! -gt $Y
    true if integer X is not greater than integer Y
  • $E -a $F
    true if expressions E and F are both true
  • $E -o $F
    true if either expression E or expression F is true