if statement help

Hi Gurus,

New to Unix... What does the following if commands do?

if [ ! "$ORACLE_HOME" ]
then
. ${HOME}/.profile
fi

if [ ! "$COMMON_SOURCED" ]
then
. ./.common
fi

Also please give me some tutorials for Unix which I can start with. Also please gimmme examples for shell scripting.

Thanks and Regards,

If the variable is empty or unset, then execute the code.

The more usual way to do it is:

if [ -z "$ORACLE_HOME" ]
then
. ${HOME}/.profile
fi

Here are some links to shell resources.

johnson,

Thanks a lot for the needful.

what does the . ${HOME}/.profile and . ./.common do?

Thanks and Regards,

They source the files ${HOME}/.profile and ./.common.

That means that they are executed in the current shell and can therefore affect the environment (e.g., set variables) of that shell.