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
Global variable declaration in shell scripting susilgandhi Shell Programming and Scripting 1 02-06-2008 12:59 AM
Help with variable declaration dsravan Shell Programming and Scripting 1 12-08-2006 03:15 PM
Double Quotes within a variable burton_1080 Shell Programming and Scripting 4 12-01-2005 01:44 PM
double variable substitution asal_email2 UNIX for Dummies Questions & Answers 1 06-14-2005 12:35 AM
Variable declaration laila63 High Level Programming 2 07-07-2004 03:37 PM

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 08-31-2007
kotasateesh kotasateesh is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 39
double variable declaration

i have variables with different values as below in KSH
AU_Holiday=1
SG_Holiday=0
KR_Holiday=1
JP_Holiday=0

$country_cd is the second variable which be one of 'AU' 'SG' 'KR' 'JP' which comes in a for loop.

form that i need to derive the variable like first one and check whether it is equal to 1 or not.

if [ $"$country_cd"_Holiday = "1" ]
then
do something
else
do something
fi

the above logic did not work can someone please help ?
  #2 (permalink)  
Old 08-31-2007
kamitsin's Avatar
kamitsin kamitsin is offline
Registered User
  
 

Join Date: Nov 2006
Location: /dev/null
Posts: 177
Quote:
$country_cd is the second variable which be one of 'AU' 'SG' 'KR' 'JP' which comes in a for loop.
sorry my friend , your requirement is not clear
  #3 (permalink)  
Old 08-31-2007
kotasateesh kotasateesh is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 39
Sorry if i have confused.
country_cd comes in for loop and i need make a variable like $AU_holiday $SG_holiday where AU and SG are from the loop
  #4 (permalink)  
Old 08-31-2007
kotasateesh kotasateesh is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 39
i found the soution myself with the below command

if [ $eval ""$country_cd"_Holiday" -eq 1 ]

it worked.
Sponsored Links
Closed Thread

Bookmarks

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 01:37 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