The UNIX and Linux Forums  


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
Passing global variable to a function which is called by another function sars Shell Programming and Scripting 4 06-30-2008 12:39 PM
Passing Parameter in SED command dsrookie UNIX for Dummies Questions & Answers 2 06-09-2008 02:25 AM
Passing string from function with '*' zam Shell Programming and Scripting 2 06-20-2007 05:19 AM
Parameter passing in a function fastgoon UNIX for Advanced & Expert Users 2 07-26-2006 06:10 AM
parameter passing kekanap Shell Programming and Scripting 8 07-20-2006 10:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-17-2006
fastgoon fastgoon is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 7
Passing a string parameter to a function

I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in.

How can I make the function receive the whole string (and not terminate at the first space it encounters)?.

part of the script I am executing

$strExtractQuery="select * from TRAN with UR"
echo "SQL to be validated: " ${strExtractQuery}
sql_validate ${strExtractQuery}

function sql_validate # Accepts 1 parameter
{
Sqltext=$1
echo "In sql validate " : ${Sqltext}
}

Output
SQL to be validated: select TRAN_I from TRAN with UR
In sql validate 1 : select


Any help?


Thanks
  #2 (permalink)  
Old 07-17-2006
Ambikesh Ambikesh is offline
Registered User
  
 

Join Date: Feb 2006
Location: California
Posts: 45
Use Double Quotes:


Code:
sql_validate "$strExtractQuery"

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 07:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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