Will this flow work


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Will this flow work
# 1  
Old 02-06-2012
Will this flow work

Code:
B()
{
}
A()
{
calling a function B
}
 
for condition
do
 
calling a function A
 
done

Shall after executing function B, the control will return back to loop?

Thanks in advance Smilie
# 2  
Old 02-06-2012
This is how it works:

Code:
#! /bin/bash
functB () {
        echo "Im in functB"
}

functA () {
        echo "Im in functA. Going to functB"
        functB
        echo "Im back in functA"
}

for x in 1
do
        echo "Im in for loop. Going to functA"
        functA
        echo "Im back in for-loop"
done

Code:
$ ./test.sh
Im in for loop. Going to functA
Im in functA. Going to functB
Im in functB
Im back in functA
Im back in for-loop

This User Gave Thanks to balajesuri For This Post:
# 3  
Old 02-06-2012
Thanks a lot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Port flow capture

I am trying to get an output using the command tcpdump -w /tmp/syn.pcap 'tcp & (tcp-syn) != 0' But I am getting the error: tcpdump: no suitable device found Is there an alternate command to achieve this? (4 Replies)
Discussion started by: ggayathri
4 Replies

2. Shell Programming and Scripting

Help with control flow in a Bash script

In my bash script I want to say "if argument 2 is anything except x, y or z, than echo this" (x y and z being words). So my script looks like this: if ] then echo "unrecognized input: $2" fi This usually works but than I also want to say "if argument 2 IS x, y, or z, but argument 4 is... (4 Replies)
Discussion started by: Jrodicon
4 Replies

3. Shell Programming and Scripting

Flow Control in CSH

hi , I am new to scripting, i have a doubt can any one pls solve it for me the code is not working set users = (user1 user2 user3) echo The users are echo $users echo Enter the USER NAME set USER_NAME = $< set i = 1; for ( i = 1; i <= $#users; i++ ) if ( $USER_NAME == $users )... (1 Reply)
Discussion started by: Manju87
1 Replies

4. Shell Programming and Scripting

Understanding Logic and Flow better

i am in an epic quagmire of horrid misunderstanding. its been a while since ive been in the scene, couldnt remember my login for the account i used to have here, so excuse the 1st post. i dont want it to seem like ima post n boogy. in any case here we go: just recently installed mandriva... (6 Replies)
Discussion started by: SirDonkeyPunch
6 Replies

5. Programming

buffer over flow detected

Hi, my program stops with a buffer overflow error, but i can't understand the problem. I have a file like: int array; //global variable void func(){ int i; for(i=0;i<n;i++)array=-1; ... } I had the error when i added the array initialization. the file is a part of a C project. What... (1 Reply)
Discussion started by: littleboyblu
1 Replies

6. UNIX for Advanced & Expert Users

Script should flow after ftp --Urgent

Hi everyone, The script actually does the ftp and gets the file to the local system. I want to do some manipulations for that file , But after doing ftp , script is not proceding and just a prompt is displayed . .... ftp code here...... .................... ............... echo "FTP... (4 Replies)
Discussion started by: kaaakrishna
4 Replies

7. IP Networking

Disabling 802.3x flow control

I have a server I would like to disable 802.3x flow control on. The host is Linux (CentOS 4.4 x86_64 w/ 2.6.9-42.0.3.EL kernel,) and I'm using the ns83820 driver for the ethernet interface in question. I've tried looking at the driver parameters (modinfo ns83820) and using ethtool (ethtool -a... (0 Replies)
Discussion started by: LivinFree
0 Replies

8. Programming

Flow Chart

Any One help how to draw the flow chart for C programe ? If any usefull link's. (1 Reply)
Discussion started by: sabari
1 Replies

9. Programming

dilemma in control flow

hello im facing a queer problem when i execute the foll code in unix # include <stdio.h> # include <unistd.h> main(int argc,char *argv) { FILE *fp = fopen("/ras/chirag/fifotest/file.fifo","a"); int i=1; fprintf(fp,argv); printf("I SLEEP"); system("date"); for (i=0;i<50;i++)... (2 Replies)
Discussion started by: tej.buch
2 Replies

10. Cybersecurity

Flow of Unix System

Hello, Is there a functional flow of the UNIX security system that I can view? (1 Reply)
Discussion started by: spanglerbrod
1 Replies
Login or Register to Ask a Question