Sponsored Content
Full Discussion: pass parameter to function
Top Forums Shell Programming and Scripting pass parameter to function Post 302275945 by vasuarjula on Monday 12th of January 2009 03:39:05 PM
Old 01-12-2009
pass parameter to function

HI all

I have a code like

##############################################

minyear()
{
curryear=$1
echo $curryear
}

##Main Program ##
minyear
exit
#######
when i execute "sh scriptname 2005" output should be like 2005 but the output is blank.
I guess i need to pass parameter to the function. Can you please let me know how to pass parameter from main function and what needs to be done in the function to collect the value
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to pass a parameter

Hi all, How to pass a parameter from a oracle pl/sql procedure parameter to shell environment and use it? (1 Reply)
Discussion started by: megh
1 Replies

2. Shell Programming and Scripting

What is the maximum number of parameter we can pass to a shell script function?

what is the maximum number of parameter we can pass to a shell script function (8 Replies)
Discussion started by: alokjyotibal
8 Replies

3. Shell Programming and Scripting

How to pass parameter to User defined function in shell script?

Hello, Can anyone guide me tin passing parameters into user defined function of shell script (KSH). Here is my code, InsertRecord() { DB_TBL=$(sqlplus $USERID/$PASSWORD@$DATABASE << EOF set head off set feed off set serveroutput on INSERT INTO TBL1 ( OLD_VAL, NEW_VAL, ... (7 Replies)
Discussion started by: Poonamol
7 Replies

4. Shell Programming and Scripting

Pass command as a function parameter

Hi guys, can someome help with this question, I have defined a function that takes a command as a parameter, but when the command is executed from the function it will throw errors because what I believe is a special character escaping issue. I tried using the backslash to escape the pipe | and >... (2 Replies)
Discussion started by: marouanix
2 Replies

5. Shell Programming and Scripting

How to pass a function with a variable parameter into another variable?

Hello again :) Am currently trying to write a function which will delete a record from a file. The code currently looks as such: function deleteRecord() { clear read -p "Please enter the ID of the record you wish to remove: " strID ... (2 Replies)
Discussion started by: U_C_Dispatj
2 Replies

6. Shell Programming and Scripting

Pass parameter

Hi, I have following for loop , please let me know how to get ${TXP_EXT_TABLE_${i}_SQL} parameter with 1DAY and 7DAY values. for i in 1DAY 7DAY do ${NZSQL_DIR}/nzsql -h ${HOST} -time -v ON_ERROR_STOP=1 -f ${SQL_DIR}/${TXP_EXT_TABLE_${i}_SQL} > ${TMP_LOG_FILE} 2>&1 done ... (4 Replies)
Discussion started by: sandy162
4 Replies

7. Shell Programming and Scripting

How to pass position parameter into function.?

Hi Gurus, I have request which needs to pass position parameter to a function. I tried below simple code, it doesn't work. #!/bin/bash func_1(){ echo $1 } func_1 $ ./set_file abc $ do I need add some to get the position para first? thanks in advance. (3 Replies)
Discussion started by: ken6503
3 Replies

8. Shell Programming and Scripting

How to pass function parameter to do loop?

Hi All, I have created one function for KSH and was running well with one parameter input since I just had to use $1 to get the parameter. Now I want to do loop for each parameter(actually filenames) . I have try to use do loop, but $i does not resolve to parameter instead it resolves to 1,... (5 Replies)
Discussion started by: mysocks
5 Replies

9. Homework & Coursework Questions

How to Dynamically Pass Parameter to plsql Function & Capture its Output Value in a Shell Variable?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: #! /bin/ksh v="ORG_ID" ... (2 Replies)
Discussion started by: sujitdas2104
2 Replies
RDF::Query::Parser::RDQL(3pm)				User Contributed Perl Documentation			     RDF::Query::Parser::RDQL(3pm)

NAME
RDF::Query::Parser::RDQL - An RDQL parser for RDF::Query VERSION
This document describes RDF::Query::Parser::RDQL version 2.908. METHODS
"new ( $query_object ) " Returns a new RDF::Query object. "parse ( $query ) " Parses the supplied RDQL query string, returning a parse tree. REVISION HISTORY
$Log$ Revision 1.5 2006/01/11 06:03:45 greg - Removed use of Data::Dumper::Simple. Revision 1.4 2005/05/08 08:26:09 greg - Added initial support for SPARQL ASK, DESCRIBE and CONSTRUCT queries. - Added new test files for new query types. - Added methods to bridge classes for creating statements and blank nodes. - Added as_string method to bridge classes for getting string versions of nodes. - Broke out triple fixup code into fixup_triple_bridge_variables(). - Updated FILTER test to use new Geo::Distance API. Revision 1.3 2005/04/26 02:54:40 greg - added core support for custom function constraints support - added initial SPARQL support for custom function constraints - SPARQL variables may now begin with the '$' sigil - broke out URL fixups into its own method - added direction support for ORDER BY (ascending/descending) - added 'next', 'current', and 'end' to Stream API Revision 1.2 2005/04/25 00:59:29 greg - streams are now objects usinig the Redland QueryResult API - RDF namespace is now always available in queries - row() now uses a stream when calling execute() - check_constraints() now copies args for recursive calls (instead of pass-by-ref) - added ORDER BY support to RDQL parser - SPARQL constraints now properly use the 'FILTER' keyword - SPARQL constraints can now use '&&' as an operator - SPARQL namespace declaration is now optional Revision 1.1 2005/04/21 02:21:44 greg - major changes (resurecting the project) - broke out the query parser into it's own RDQL class - added initial support for a SPARQL parser - added support for blank nodes - added lots of syntactic sugar (with blank nodes, multiple predicates and objects) - moved model-specific code into RDF::Query::Model::* - cleaned up the model-bridge code - moving over to redland's query API (pass in the model when query is executed) AUTHOR
Gregory Williams <gwilliams@cpan.org> perl v5.14.2 2012-01-31 RDF::Query::Parser::RDQL(3pm)
All times are GMT -4. The time now is 11:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy