Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 








  Oracle Tips by Burleson

Using the test command or [ expression ]

You can use either the test command or just an expression ([ expression ]) to evaluate whether an expression is true (zero) or false (non-zero). As the following example illustrates, you can accomplish the same expression evaluation different ways.

Evaluating expressions

$ x=3

$ y=7


$ test $x -lt $y && echo " Option 1 -- ${x} is less than ${y} "

Option 1 -- 3 is less than 7



$ if test $x -lt $y

> then

> echo " Option 2 -- ${x} is less than ${y} "

> fi

Option 2 -- 3 is less than 7


$ if [ $x -lt $y ]

> then

> echo " Option 3 -- ${x} is less than ${y} "

> fi

Option 3 -- 3 is less than 7


The following extraction from the Linux man pages summarizes the different types of tests that can be performed:

File type tests


file exists and is block special

file exists and is character special

file exists and is a directory

file exists

file exists and is a regular file

file exists and is set-group-ID

file exists and is owned by the effective group ID

file exists and is a symbolic link (same as -L

file exists and has its sticky bit set

file exists and is a symbolic link (same as -h)

file exists and is owned by the effective user ID

file exists and is a named pipe

file exists and is readable

file exists and is a socket

file exists and has a size greater than zero

file descriptor FD (stdout by default) is opened on a terminal

file exists and its set-user-ID bit is set

file exists and is writable

file exists and is executable

file1 is newer (modification date) than file2

file1 is older than file2

file1 and file2 have the same device and inode numbers

The above book excerpt is from:

Easy Linux Commands
Working Examples of Linux Command Syntax

ISBN: 0-9759135-0-6   

Terry Clark 

Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational