![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Issue with String Comparison (if) | waterdrop | Shell Programming and Scripting | 3 | 12-04-2008 06:20 PM |
| string comparison | Jatsui | Shell Programming and Scripting | 5 | 02-04-2008 04:28 PM |
| string comparison | fedora | Shell Programming and Scripting | 2 | 01-03-2007 03:20 PM |
| Help with if loop (string comparison) | psynaps3 | Shell Programming and Scripting | 4 | 07-07-2006 02:36 AM |
| String Comparison | abey | High Level Programming | 1 | 10-19-2005 12:08 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
string comparison
Hi Guys
i need to write a script to check the file structure I have added the the file headers in the configuration file and execute the file at the start of the script. Now the function Code:
checkFileStructure()
{
echo "Inside the function"
filetocheck=$1
fileheader=$2
if [[ "$filetocheck" == "Asset_Class" && "$fileheader" != "$HEADER_ASSET" ]]
then
echo "For Asset"
export Status=22
return $Status
elif [[ "$filetocheck" == "Currency" && "$fileheader" != "$HEADER_CURRENCY" ]]
then
echo "For Currency"
export Status=22
return $Status
elif [[ "$filetocheck" == "Expense" && "$fileheader" != "$HEADER_EXPENSE" ]]
then
echo "For Expense"
export Status=22
return $Status
elif ][ "$filetocheck" == "Geography" && "$fileheader" != "$HEADER_GEOGRAPHY" ]]
then
echo "For Geo"
export Status=22
return $Status
elif [ "$filetocheck" == "Instrument" && "$fileheader" != "$HEADER_INSTRUMENT" ]]
then
echo "For Inst"
export Status=22
return $Status
else
export Status=0
return $Status
fi
}
all the file headers are tab separated string with some spel characters the && operatos is not working. everytime it goes into the if & elif statements not into the else statement How to solve the problem. Last edited by Yogesh Sawant; 03-25-2009 at 02:42 AM.. Reason: added code tags |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|