Sponsored Content
Top Forums Shell Programming and Scripting How to dynamically name as function in shell? Post 302851985 by Klashxx on Tuesday 10th of September 2013 08:28:13 AM
Old 09-10-2013
Are you trying to achieve something like this?
Code:
# cat test.sh 
function tnsrec_SERVICE1 {
echo "Test ok"
}[

SERVICE_NAME=SERVICE1

eval tnsrec_${SERVICE_NAME}

Code:
# ./test.sh 
Test ok

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Managing dynamically multiple shell

I want to launch some shell scripts. I would have the possibility to change the number of shell scripts launched dynamically by modifying a variable, or a configuration file. For example, I start to launch 4 scripts at the same time, and after that, by modifying a variable, 6 scripts are... (0 Replies)
Discussion started by: gonzo38
0 Replies

2. Shell Programming and Scripting

Shell script dynamically case in VAR

Hallo, I am working on a kdialog. This shall be able to load the required commands from a .conf file. First step runs good by loading the entries (selectabel entries) in a variable: MIRRORSELECT=$(kdialog --radiolist "Select your nearest mirror" $VAR1) The kdialog is accordingly correct... (2 Replies)
Discussion started by: ACTGADE
2 Replies

3. Shell Programming and Scripting

Dynamically creating text files using shell script

Hi All, I want to create a shell script which dynamically create text files. i am using the following script $i=1 while do cat > test_$i.txt done but while running the script it was stopping(the cursor not going to next step, i have to enter ctrl+c to make it stop). it is creating only... (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies

4. Programming

C function call dynamically

Hi. I need help with a C/C++ question and i hope someone can help me or give me some ideas. Is possible to build a function C/C++ call dynamically? I.e, i have an array with pointer functions and these functions can have different number of parameters and types. These parameters and their... (14 Replies)
Discussion started by: pogdorica
14 Replies

5. Shell Programming and Scripting

dynamically adding values in c-shell

I am needing to create a variable(changing) and assign it a value(changing) ... I am using C-Shell.. Example: foreach account in ($Accountlist) set account_connect = "$account/$account_pass" end I want to make set account_connect to store various values ? $account_connect did not... (3 Replies)
Discussion started by: shafi2all
3 Replies

6. Shell Programming and Scripting

how to create the files dynamically in c shell script

how can i CREATE a txt file dynamically in c shell: for instance: #! /bin/csh for each i (*) cat>file$i.txt for each j do .... (1 Reply)
Discussion started by: jdsignature88
1 Replies

7. Shell Programming and Scripting

Shell script variable names created dynamically

Hi, I'm trying to use a config file to define frequencies for checking log files. If the config file contains a frequency it will be used else a default value. The format of the config file (and hence the environment variable) is FREQ_log_logname=value A test shell script as below:... (2 Replies)
Discussion started by: u671296
2 Replies

8. UNIX for Beginners Questions & Answers

Putting query result dynamically to one cell of table from shell

I have to send a data in mail table format.only one cell need to get dynamically from query. my code is like (echo '<table boarder="1"> echo '<tr><td>stock</td><td>/path</td><td>.........</td></tr>' echo '</table> )sendmail.. in ......... I am trying to get query result.By putting query... (2 Replies)
Discussion started by: meera_123
2 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

10. Shell Programming and Scripting

Shell script to apply functions to multiple columns dynamically

Hello, I have a requirement to apply hashing algorithm on flat file on one or more columns dynamically based on header sample input file ID|NAME|AGE|GENDER 10|ABC|30|M 20|DEF|20|F say if i want multiple columns based on the header example id,name or id,age or name,gender and hash and... (13 Replies)
Discussion started by: mkathi
13 Replies
Test::Unit::Result(3pm) 				User Contributed Perl Documentation				   Test::Unit::Result(3pm)

NAME
Test::Unit::Result - unit testing framework helper class SYNOPSIS
This class is not intended to be used directly DESCRIPTION
This class is used by the framework to record the results of tests, which will throw an instance of a subclass of Test::Unit::Exception in case of errors or failures. To achieve this, this class gets called with a test case as argument. It will call this test case's run method back and catch any excep- tions thrown. It could be argued that Test::Unit::Result is the heart of the PerlUnit framework, since TestCase classes vary, and you can use one of sev- eral Test::Unit::TestRunners, but we always gather the results in a Test::Unit::Result object. This is the quintessential call tree of the communication needed to record the results of a given test: $aTestCase->run() { # creates result $aTestResult->run($aTestCase) { # catches exception and records it $aTestCase->run_bare() { # runs test method inside eval $aTestCase->run_test() { # calls method $aTestCase->name() # and propagates exception # method will call Assert::assert() # to cause failure if test fails on # test assertion # it finds this because $aTestCase is-a Assert } } } } Note too that, in the presence of Test::Unit::TestSuites, this call tree can get a little more convoluted, but if you bear the above in mind it should be apparent what's going on. AUTHOR
Copyright (c) 2000-2002, 2005 the PerlUnit Development Team (see Test::Unit or the AUTHORS file included in this distribution). All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
o Test::Unit::Assert o Test::Unit::TestCase o Test::Unit::Exception perl v5.8.8 2006-09-13 Test::Unit::Result(3pm)
All times are GMT -4. The time now is 06:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy