Sponsored Content
Top Forums Shell Programming and Scripting multiple looping with case and funtion showing error, Please help Post 302556633 by ctsgnb on Monday 19th of September 2011 08:33:52 AM
Old 09-19-2011
I didn't try it so maybe it would require some fix, but in the main loop maybe it could be better with something like :
Code:
while true 
do
    menu
    case $choice in
    1)            
        while :
        do
            chkout1
            case $tgtser in
            1|2|3|4|5|6|7|8|9|10|11)
                echo "Checked out to test server ..."
                break
            ;;
            *)      echo "Opps !!! please select a valid option"
                sleep 2
            ;;
            esac
        done
    ;;
    2)
        echo "Checked in ..."
    ;;
    3)
        echo "Checked out to local machine ..."
    ;;
    4)
        echo "Exiting ... "
    ;;
    *)
        echo "Opps !!! please select a valid option (1/2/3/4)" ;;
        sleep 2
    ;;
esac
done

You must not make duplicate calls of 'chkout1' or 'menu' you must use the while loop instead.

Last edited by ctsgnb; 09-19-2011 at 09:39 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

compile funtion

Hi, This is the first time, i am doing UNIX & C stuff. I have written one funtion like #include <stdio.h> seq(num) int num; { int i,sum; for (i=1; i<=num;i++) sum+=i; return(sum); } this seq funtion should have return values to unix script. like .. (4 Replies)
Discussion started by: sundarm
4 Replies

2. Shell Programming and Scripting

multiple case

hi all im working in tcsh shell. In sh shell i write for example: case in $www 1 | 2 | 3) arguments;; 4 | 5 | 6) arguments;; esac can anybody tell me the equivalent to tcsh of 1 | 2 | 3)? (2 Replies)
Discussion started by: micromicrin
2 Replies

3. UNIX for Dummies Questions & Answers

Help in Array looping and creating multiple lines

hi Gurus, I'm a newbie in scripting please check my script if this is correct. I think there's something wrong with it but I;m not sure. I'm trying to create multiple lines using awk from external xml files but i want to add additonal info in the data manually Since i don't knwo how to... (0 Replies)
Discussion started by: sexyTrojan
0 Replies

4. Shell Programming and Scripting

Multiple conditions in a CASE statement

is it possible to use multiple conditions in a CASE statement? And if so, what is the syntax? I'm trying to use one but can't seem to get it right. I want the statement to be CASE $vendor OR $alias condition 1) statements; condition 2) statements; etc. esac but I keep... (25 Replies)
Discussion started by: Straitsfan
25 Replies

5. Shell Programming and Scripting

Looping for multiple directories

Hi experts, I am totally stuck with this. I run a looping "for" command for multiple directories, manually, I have done this : vfor dir in A B; do cp -p $dir/X.txt X-${dir}.txt done where A and B is directory name. However, I need to run for many directories. So I have tried this :... (7 Replies)
Discussion started by: guns
7 Replies

6. Shell Programming and Scripting

Choose multiple conditions in case?

Hi all, I am attempting to create a shell script to optimize some routine process. I want this script can let user select the actions they want to do. But I met a problem that my script can only read one input and then do one action. Is it possible to let my script to run more than one... (2 Replies)
Discussion started by: kaiya
2 Replies

7. Shell Programming and Scripting

Looping in case of duplicates ...

complinagetest () #function name { if ;then rm complins.dat fi touch complins.dat i=0 while read line do if ; then va=`grep -w "$line" datalins1.dat | awk BEGIN'{FS="\`~"}{if ( $3=="'$line'" ) {print $4}}'` i=$(($i+1)) varits=$(echo $va|awk -v varif="$i" '{print... (1 Reply)
Discussion started by: amitpaul01
1 Replies

8. Shell Programming and Scripting

Looping in case of duplicates

14`~abc`~9`~11 14`~abc`~9`~10 36`~ee`~7`~9 36`~ee`~8`~9 58`~rtt`~12`~7 70`~gff`~13`~8 86`~tyu`~6`~12 86`~tyu`~6`~13 92`~mjh`~5`~6 28`~jkl`~10`~DNA 32`~mjk`~SNA`~5 82`~jkli`~11`~DNA ------------------------------------ Field Seperator: `~ The concept is to start with SNA in the 3rd... (8 Replies)
Discussion started by: barath
8 Replies

9. Shell Programming and Scripting

Looping all subdierctories in multiple pipes

Hello friends, I want to run this code on every document in every sub-directory. tr -d '\n' < MulitpleInput.txt | awk '{gsub(/\. /,".\n");print}' | grep “\ I tried several looping techniques but couldn't get it to run in this example. Any ideas? Thank you (2 Replies)
Discussion started by: danbroz
2 Replies

10. Programming

Looping through multiple arrays in C.

Not sure if this is possible, but I've tried this about a thousand ways now. I am making something with a lot of arrays. I thought I could put the array names into a separate array and then loop through them to call all of their elements. This is the best I've got so far: #include <stdio.h>... (4 Replies)
Discussion started by: Azrael
4 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 09:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy