Sequential Function Execution


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sequential Function Execution
# 1  
Old 02-07-2014
Display Sequential Function Execution

I am having two different function in my script. When control is at first function I do not want to execute another function. How I can do that?
Help is highly appreiated as I am not sure How I can do it in Unix?

Thanks,
Vikram.
# 2  
Old 02-07-2014
I'm not sure if I understood your question correctly. See if this helps:
Code:
function func1 {
    # statements
    # statements
    echo "func1"
    f1_flag=1
}

function func2 {
    if [ $f1_flag == 1 ]
    then
        echo "func1 has already run. So, exiting from func2"
        return 1
    fi
    echo "func2"
    # statements
    # statements
}

func1
func2

# 3  
Old 02-09-2014
Unless you call funcx from within funcy, there's no chance they execute simultaneously in a single process. Or are you talking of multiple processes?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Variable gets auto updated after function execution

Hi Team In the below code, irrespective of the if statement that gets executed, retcd is being assigned a standard value(1) instead of changing as per code. Could you please help to see where is it going wrong. rval=0 CONF_FILE=/apps/wmroot/scripts/props/UMPath.properties NOHUP="nohup"... (3 Replies)
Discussion started by: harishshankar
3 Replies

2. Shell Programming and Scripting

Function command execution from root

I have a function hello, that is echoing i have put that function in .bash1 file then recalling the function with same user but with su command but it is not working. username -> test function -> below function save in .bash1 function hello() { echo "Hello, $1!" } export -f hello I... (2 Replies)
Discussion started by: learnbash
2 Replies

3. Shell Programming and Scripting

Sequential execution of commands in ksh

I need to run few commands in a ksh script sequentially. Some of the commands are jobs submitted to the server and the consecutive commands are dependent on the completion of the jobs submitted to the server. It works if i separate the commands into different files like this #!/bin/ksh... (1 Reply)
Discussion started by: prashob123
1 Replies

4. Shell Programming and Scripting

Sequential numbers

Hi All, I am looking for a simple way to write numbers to a file sequentially starting from 1 and ending on a specified upper limit. Example of the output file is below Example 1 2 3 4 5 . . . . 1000 please let me know the best way to do it. (10 Replies)
Discussion started by: Lucky Ali
10 Replies

5. Programming

Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX

Writing a Tool to simulate non-sequential disk I/O (simulate db file sequential read) in C POSIX I have over the years come across the same issue a couple of times, and it normally is that the read speed on SAN is absolutely atrocious when doing non-sequential I/O to the disks. Problem being of... (7 Replies)
Discussion started by: vrghost
7 Replies

6. Shell Programming and Scripting

sequential to line sequential

Hi I have a file sequential way i.e. written in contineous mode and the Record Seperator is AM from which the record is seperated .Now to process I have to make line sequential,and more over record length is not same it varies as per the input address, AM1234563 John Murray 24 Old streeet old... (5 Replies)
Discussion started by: vakharia Mahesh
5 Replies

7. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

8. UNIX for Dummies Questions & Answers

Sequential execution in shell script?

I've a shell script that invokes a URL of an application to do some work, e.g., http://www.abc.com/myservlet?action=helloworld.Does the shell wait for a return value from the URL call before proceeding to the next line of command? (6 Replies)
Discussion started by: chengwei
6 Replies

9. Shell Programming and Scripting

Sequential execution of job in cron

Hi I have a file say xyz.sh, whose contents are as follows : *************************** #! /bin/ksh set -x . /a.sh . /b.sh . /c.sh ***************************** Now will this execute all the three process simultaneously or sequentially? If it will process simultaneously, is... (3 Replies)
Discussion started by: pankajkrmishra
3 Replies

10. Programming

Reading special characters while converting sequential file to line sequential

We have to convert a sequential file to a 80 char line sequential file (HP UX platform).The sequential file contains special characters. which after conversion of the file to line sequential are getting coverted into "new line" or "tab" and file is getting distorted. Is there any way to read these... (2 Replies)
Discussion started by: Rajeshsu
2 Replies
Login or Register to Ask a Question