Sponsored Content
Full Discussion: "goto" like command in UNIX
Top Forums Shell Programming and Scripting "goto" like command in UNIX Post 302891311 by wisecracker on Wednesday 5th of March 2014 03:01:44 AM
Old 03-05-2014
Shell scripting has no concept of GOTO.

Try using functions for your "yes/no" results and run your "case" routine inside a "while"
loop remembering to call you functions...
Example:-
Code:
yes()
{
        echo "Do something."
}
no()
{
        echo "Do something else."
}
while true
do
        # Your case code, remembering to call "yes" or "no" as commands...
        # Remember also to give yourself a getout clause...
done

Off to work...

Last edited by wisecracker; 03-05-2014 at 04:18 AM.. Reason: Typo...
This User Gave Thanks to wisecracker For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour

Hi, We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0. Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ? I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc. ... (1 Reply)
Discussion started by: sameerdes
1 Replies

2. UNIX for Dummies Questions & Answers

Is there a "goto" command for AIX?

I have a korn script that needs to check for an empty file -- if the file is empty, I want the script to execute a cleanup step before exiting. Here's what I have: if ] then echo " Input file has no records -- skipping to step 9." goto cleanup fi ... ... (3 Replies)
Discussion started by: jderr
3 Replies

3. UNIX for Dummies Questions & Answers

Unix "at" / "Cron" Command New Problem...Need help

Hi All, I am trying to schedule a one time job using the at command with the help of shell script for my project. The shell script should take a parameter as a command line argument from the at command itself. Is it possible to take a command line parameter for a shell script in the command... (3 Replies)
Discussion started by: Mohanraj
3 Replies

4. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

5. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

6. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

7. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

8. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

9. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
xpacmdnew(3)							SAORD Documentation						      xpacmdnew(3)

NAME
XPACmdNew - create a new XPA public access point for commands SYNOPSIS
#include <xpa.h> XPA XPACmdNew(char *class, char *name); DESCRIPTION
Create a new XPA public access point for commands that will share a common identifier class:name. Enter this access point into the XPA name server, so that it can be accessed by external processes. XPACmdNew() returns an XPA struct. It often is more convenient to have one public access point that can manage a number of commands, rather than having individual access points for each command. For example, it is easier to command the ds9 image display using: echo "colormap I8" | xpaset ds9 echo "scale log" | xpaset ds9 echo "file foo.fits" | xpaset ds9 then to use: echo "I8" | xpaset ds9_colormap echo "log" | xpaset ds9_scale echo "foo.fits" | xpaset ds9_file In the first case, the commands remain the same regardless of the target XPA name. In the second case, the command names must change for each instance of ds9. That is, if a second instance of ds9 called DS9 were running, it would be commanded either as: echo "colormap I8" | xpaset DS9 echo "scale log" | xpaset DS9 echo "file foo.fits" | xpaset DS9 or as: echo "I8" | xpaset DS9_colormap echo "log" | xpaset DS9_scale echo "foo.fits" | xpaset DS9_file Thus, in cases where a program is going to manage many commands, it generally is easier to define them as commands associated with the XPACmdNew() routine, rather than as separate access points using XPANew(). When XPACmdNew() is called, only the class:name identifier is specified. Each sub-command is subsequently defined using the XPACmdAdd() routine. SEE ALSO
See xpa(7) for a list of XPA help pages version 2.1.14 June 7, 2012 xpacmdnew(3)
All times are GMT -4. The time now is 01:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy