Sponsored Content
Full Discussion: Alternative for goto
Top Forums Shell Programming and Scripting Alternative for goto Post 302866551 by Scrutinizer on Tuesday 22nd of October 2013 09:15:14 AM
Old 10-22-2013
Instead of a goto you could use something like this:
Code:
start() {
.....
}

while :
do
  rval=`start`
  if [ "$rval" -eq 4 ]
  then
    echo if condition true
    sqlplus -l scott/tiger <<EOF
    select * from department;
    EXIT
EOF
    break
  else
     sleep 30
  fi
done

In your start function the second ! should be at the first character position on the line or it will not work..

Are you sure it is Bourne Shell, are you on Solaris, otherwise /bin/sh is likely a POSIX shell which allows or a less restrictive syntax.
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to goto in ksh

Hi, I'm trying to use the goto in ksh but it does not appear to be a valid command. Is that only valid in csh? Anything similar in ksh that I can use? Appreciate any help you can provide. Thanks. geraldine (4 Replies)
Discussion started by: Geraldine
4 Replies

2. Shell Programming and Scripting

GOTO LOOP in KORNE SHELL

All Please help to provide "goto" functionality in KORN shell script. ex: 1: Command Process some command if check some variable true goto 1 else process some other Please help to implement this example in korne... (1 Reply)
Discussion started by: DeepakXavier
1 Replies

3. Shell Programming and Scripting

Use of GOTO statement in scripts

Hey Guys.. I just want to know how to use Goto statement in shell scripts. I know the basic use of statement. Goto Label The above statement will search for some label which must be defined in the script itself as: label: I tried these combinations but I didn't work out for me and I'm... (7 Replies)
Discussion started by: vikasduhan
7 Replies

4. Shell Programming and Scripting

goto statement

I have a test script for using goto statement but its not working. please help i tried both in linux and hp-ux it's not working please help #! /bin/ksh t=`ps -ef|grep ti.sh|grep -v grep` if ; then goto start else goto stop fi start: echo "start" stop: echo "stop" (5 Replies)
Discussion started by: Krrishv
5 Replies

5. UNIX for Dummies Questions & Answers

Stuck after typing goto

uname -a returns: SMP Tue May 17 17:52:23 EDT 2005 i686 athlon i386 GNU/Linux I have many aliases beginning with "goto" so... if I type goto and then hit return (oops) A goto prompt pops up and I cant exit from it(I tried MANY key seqs) The only way to exit is to kill the term window... (2 Replies)
Discussion started by: rairey
2 Replies

6. Solaris

Goto last visted directory

Dear All, Can any one pls let me the command for how to goback to previous visited directory from the current working directory in SunOS ? In case of HP-UX; the same can be resolved through "cd -" command. Thanks in advance! Prasanth Babu. (6 Replies)
Discussion started by: prasanth_babu
6 Replies

7. Shell Programming and Scripting

Using A Goto Label?

Im trying to do something like this but I cant find any documentation. read X if then goto ThisLine fi OTHER CODE OTHER CODE Label: ThisLine echo "You entered 1" (5 Replies)
Discussion started by: Grizzly
5 Replies

8. Shell Programming and Scripting

How to use GOTO stmt in Unix scripting?

my code does somthing like this: #!bin/ksh sqlplus / | While read id do temp=`echo $id` i = i+1 done j=0 while do --connecting to sql and executing a Stored proc for 1st id --checking for the status status = $? if error --need to... (1 Reply)
Discussion started by: RP09
1 Replies

9. Shell Programming and Scripting

Goto - UNIX v6 Manual Questions

Hey :) I am trying to understand the command goto. I have some questions regarding the goto manual. 1.What does the underlined part mean? I'm not allowed to type goto in the shell? But if goto is written into a file everything is okay? 2.So if a part of my file looks like this ... goto... (8 Replies)
Discussion started by: orbit
8 Replies

10. Shell Programming and Scripting

A dash to GOTO or a dash from GOTO, that is the question...

Well, guys I saw a question about GOTO for Python. So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too). Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'... This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies
read(9E)							Driver Entry Points							  read(9E)

NAME
read - read data from a device SYNOPSIS
#include <sys/types.h> #include <sys/errno.h> #include <sys/open.h> #include <sys/uio.h> #include <sys/cred.h> #include <sys/ddi.h> #include <sys/sunddi.h> int prefixread(dev_t dev, struct uio *uio_p, cred_t *cred_p); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). This entry point is optional. PARAMETERS
dev Device number. uio_p Pointer to the uio(9S) structure that describes where the data is to be stored in user space. cred_p Pointer to the user credential structure for the I/O transaction. DESCRIPTION
The driver read() routine is called indirectly through cb_ops(9S) by the read(2) system call. The read() routine should check the valid- ity of the minor number component of dev and the user credential structure pointed to by cred_p (if pertinent). The read() routine should supervise the data transfer into the user space described by the uio(9S) structure. RETURN VALUES
The read() routine should return 0 for success, or the appropriate error number. EXAMPLES
Example 1 read() routine using physio() The following is an example of a read() routine using physio(9F) to perform reads from a non-seekable device: static int xxread(dev_t dev, struct uio *uiop, cred_t *credp) { int rval; offset_t off; int instance; xx_t xx; instance = getminor(dev); xx = ddi_get_soft_state(xxstate, instance); if (xx == NULL) return (ENXIO); off = uiop->uio_loffset; rval = physio(xxstrategy, NULL, dev, B_READ, xxmin, uiop); uiop->uio_loffset = off; return (rval); } SEE ALSO
read(2), write(9E), physio(9F), cb_ops(9S), uio(9S) Writing Device Drivers SunOS 5.11 19 Nov 1997 read(9E)
All times are GMT -4. The time now is 07:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy