can we use any function like (go to lable1 like in C) in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting can we use any function like (go to lable1 like in C) in script
# 1  
Old 07-12-2011
can we use any function like (go to lable1 like in C) in script

hi
I want use function go to line number or else any lable name like in C language in script
# 2  
Old 07-12-2011
Depending on context (an example of what you wish to do would help) the break builtin in bash may help,
Code:
       break [n]
              Exit  from within a for, while, until, or select loop.  If n is
              specified, break n levels.  n must be >= 1.   If  n  is  greater
              than  the  number  of  enclosing loops, all enclosing loops are
              exited.  The return value is 0 unless the shell is not  execut-
              ing a loop when break is executed.

# 3  
Old 07-12-2011
You also have
Code:
 continue [ n ]
       Resume  the  next  iteration  of the enclosing for,
       while, until, or select loop.  If n  is  specified,
       then resume at the n-th enclosing loop.

# 4  
Old 07-12-2011
Is goto statement will work???
Smilie
Any alternative for goto.......??
# 5  
Old 07-12-2011
Most script languages don't support the 'goto' statement. The closest they have is 'case'.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

2. Shell Programming and Scripting

Function Script

First time doing a function script and I am getting an error. Anyone knows the problem? #!/bin/bash hello() { echo "Executing function hello" } echo "Script has started now" hello echo "Script will end" (3 Replies)
Discussion started by: rpiboy
3 Replies

3. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

4. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

5. Shell Programming and Scripting

Shell Script function to use script name for log file output

Hi Team - I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n? %~n is a DOS variable that dispayed the script name. For instance (in DOS): REM... (11 Replies)
Discussion started by: SIMMS7400
11 Replies

6. Shell Programming and Scripting

Help for exiting the function not script

function2() { cmd1 cmd2 cmd3 .... cmdn } function2() { cmd11 cmd12 cmd13 .... .... } for i in {1,2} (7 Replies)
Discussion started by: yanglei_fage
7 Replies

7. Shell Programming and Scripting

Call shell script function from awk script

hi everyone i am trying to do this bash> cat abc.sh deepak() { echo Deepak } deepak bash>./abc.sh Deepak so it is giving me write simply i created a func and it worked now i modified it like this way bash> cat abc.sh (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

8. Shell Programming and Scripting

Wait function in a script

Hi everyone, I need some help to create a script. This script have to create a file once all the process inside are finish. Here how I want to do : #!/bin/ksh /home/oracle/save1.ksh & proc_id1=$! /home/oracle/save2.ksh & proc_id2=$! /home/oracle/save3.ksh & proc_id3=$! ... (4 Replies)
Discussion started by: remfleyf
4 Replies

9. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

10. Shell Programming and Scripting

call function in one script from another script

Hello experts, Is it possible to call function in one script from another script? Example. Script 1: #!/bin/bash function1(){ } Script 2: #!/bin/bash #code to call function1 in Script 1 :confused: thanks you (6 Replies)
Discussion started by: minifish
6 Replies
Login or Register to Ask a Question