How to set a label/number for a function in a shells script


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to set a label/number for a function in a shells script
# 1  
Old 11-03-2008
How to set a label/number for a function in a shells script

Can any one let me know like how cn i set an label or number for each function whihc are there in an shells script:

for example

cd /opt/qcom/test/

function1()
function2()
function3()
-------

i ahe a script like this .now i want to count each of this function like 1, 2, 3,............

and using another script i wnat to call each of these 1,2,3 ?

can any one help me in this
Image
# 2  
Old 11-04-2008
I see no problem why not just to label them as you already did. Why don't you try that out first?!

Also between shell scripts you don't call functions of each other shell script directly but usually pass arguments/parameters when calling the other shell script and then processing them maybe with functions inside like $1,$2,$3,....,$@,$*
# 3  
Old 11-04-2008
may be i am not clear with my question

let me explain you more clearly
i have afollowing script
example1.sh
cd /opt/qcom/bin/tests
echo "=================================================================================================== =========================="
let totalcount=totalcount+1;
./fbtest
if [ $? -ne 0 ]
then
echo "script: TEST FAILED"
testcase="fb_test"
echo "testcase is = $testcase"
echo "the test cases failing in $iteration_count iteration is $testcase driver" >> /home/mohanav/DeviceDrivers/7625/FFA/1305/1RUN/1305_FFA_7625_3run.txt
let failcount=failcount+1;
fi
echo "=================================================================================================== =========================="
let totalcount=totalcount+1;
modprobe smd_test
sleep 5
./smd_test
if [ $? -ne 0 ]
then
echo "script: TEST FAILED"
testcase="smd_test"
echo "testcase is = $testcase"
echo "the test cases failing in $iteration_count iteration is $testcase driver" >> /home/mohanav/DeviceDrivers/7625/FFA/1305/1RUN/1305_FFA_7625_3run.txt
let failcount=failcount+1;
fi
echo "=================================================================================================== =========================="
let totalcount=totalcount+1;
./pmem_test
if [ $? -ne 0 ]
then
echo $?
echo "script: TEST FAILED"
testcase="pmem_test"
echo "testcase is = $testcase"
echo "the test cases failing in $iteration_count iteration is $testcase driver" >> /home/mohanav/DeviceDrivers/7625/FFA/1305/1RUN/1305_FFA_7625_3run.txt
let failcount=failcount+1;
fi
echo "=================================================================================================== =========================="
let totalcount=totalcount+1;
./clk_test.sh -v
if [ $? -ne 0 ]
then
echo $?
echo "script: TEST FAILED"
testcase="clk_test"
echo "testcase is = $testcase"
echo "the test cases failing in $iteration_count iteration is $testcase driver" >> /home/mohanav/DeviceDrivers/7625/FFA/1305/1RUN/1305_FFA_7625_3run.txt
let failcount=failcount+1;
fi
echo "=================================================================================================== =========================="
let totalcount=totalcount+1;
./vreg_test.sh
if [ $? -ne 0 ]
then
echo $?
echo "script: TEST FAILED"
testcase="vreg_test"
echo "testcase is = $testcase"
echo "the test cases failing in $iteration_count iteration is $testcase driver" >> /home/mohanav/DeviceDrivers/7625/FFA/1305/1RUN/1305_FFA_7625_3run.txt
let failcount=failcount+1;
fi

Now the probelm is if i run this script it will excute them by one by one ........
but now my requirmnet is i need to execute them randomly using another script

like
./pmem_test,
./fb_test



so how to do this
# 4  
Old 11-04-2008
Parallelization is easy with nohup &, but you will not be able to get the returncodes back... At least I don't know how. Maybe someone else knows.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Bad magic number in disk label.

This is first time post...found this forum when looking for possible solution to fix my sun pc. Just one day can't boot it already showing the following: Boot device: disk File args: Bad magic number in disk label Can't open disk label package Evaluating: boot Can't open boot device... (40 Replies)
Discussion started by: SHuKoSuGi
40 Replies

2. Solaris

Script to label a disk

Hi Guys, Do you have any script to label a disk automatically. It is part of my script but I am not able to find solution to label this inside script without user intervention. (2 Replies)
Discussion started by: prashant2507198
2 Replies

3. Shell Programming and Scripting

Calling a function which uses expect from a shells script

Hi all, This is the first time i am using expect. I am trying to call a function with in the shell script. The function will shh to a new server and will pass the password using expect and send. I need help in calling the fuction i am getting follaowing errors... here the script ... (8 Replies)
Discussion started by: firestar
8 Replies

4. Solaris

Recover label, wrong magic number

Is there a way to recover label? I could install (sparc) Solaris again, but it would take a lot of time. (5 Replies)
Discussion started by: orange47
5 Replies

5. Solaris

corrupt label - wrong magic number

I have created 1 LUN. 1)LUN 00BB 200GB /dev/rdsk/c1t3d44 /dev/rdsk/c2t28d44 /dev/rdsk/c3t19d44 /dev/rdsk/c4t12d44 2) Already added the new entry into sd.conf and rebooted. 3) Already done these: powercf –q power config 4) power display dev=all I can see the new Symmetrix device.... (1 Reply)
Discussion started by: sirius20d
1 Replies

6. 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

7. Solaris

BAD magic number in disc label...

Hello All, I m very new to this forum. i m having SUN NETRA X1 server with 40 GB HDD (Seagate) & 128 MB RAM. i m trying this server for SUN 10 Practise. As i m installing SUN 9 /10 with CD ,its giving me error after OK propmt *************************** #boot cdrom or #boot cdrom... (16 Replies)
Discussion started by: amrut_k
16 Replies

8. AIX

Script: how to find out the label of a tape and if its an mksysb one ?

Hi, how can I find out though kron shell (aix 4.2) what the label of a tape is ? Also, how can I find out if that tape has been used for an mksysb and when ? (1 Reply)
Discussion started by: Browser_ice
1 Replies

9. Solaris

Big UH-OH "Bad magic number in disk label"

I tried rebooting my Sun server just a few minutes ago and I got the following at boot: -- Sun Fire 280R (UltraSPARC-III+) , No Keyboard Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved. OpenBoot 4.5, 1024 MB memory installed, Serial #xxxxxxxxx Ethernet address... (6 Replies)
Discussion started by: deckard
6 Replies

10. Shell Programming and Scripting

%.*s function in shells

Can anyone tell me now to achieve the printf %.*s functionality in shell script, (sh/ksh). I want to append x number of (same)characters at the end of a file without using normal looping. Cheers. qanda (6 Replies)
Discussion started by: qanda
6 Replies
Login or Register to Ask a Question