The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How is use sselect statement o/p in insert statement. nkosaraju Shell Programming and Scripting 2 08-06-2008 09:26 PM
If statement - How to write a null statement april Shell Programming and Scripting 3 04-16-2008 01:14 PM
using && in if statement .. jisha Shell Programming and Scripting 7 02-01-2008 07:52 AM
if Statement... cengiz Shell Programming and Scripting 6 07-13-2005 06:55 AM
Do statement vasikaran UNIX for Dummies Questions & Answers 7 07-04-2005 08:39 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-13-2008
reksab_16 reksab_16 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 2
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,
  #2 (permalink)  
Old 10-13-2008
cfajohnson's Avatar
cfajohnson cfajohnson is online now Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,311
Quote:
Originally Posted by reksab_16 View Post
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

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

The more usual way to do it is:

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

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

Here are some links to shell resources.
  #3 (permalink)  
Old 10-13-2008
reksab_16 reksab_16 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 2
Thanks a lot

johnson,

Thanks a lot for the needful.

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

Thanks and Regards,
  #4 (permalink)  
Old 10-13-2008
cfajohnson's Avatar
cfajohnson cfajohnson is online now Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,311
Quote:
Originally Posted by reksab_16 View Post
what does the . ${HOME}/.profile and . ./.common do?

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.
Sponsored Links
Closed Thread

Bookmarks

Tags
unix commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:26 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0