Sponsored Content
Top Forums Shell Programming and Scripting Help understanding syntax error Issue Post 302310688 by giannicello on Sunday 26th of April 2009 11:37:52 AM
Old 04-26-2009
Once you align your code correctly so you will be able to see where each case begins and ends, you will then also see where to correctly terminate your options and case statements.
For example:

Code:
         Q|q)clear
           echo "Are you sure you want to quit? Y/N"
           read choice1
           case $choice1 in
              N|n)clear
                 echo "Hit Enter Key to continue"
                 read junk;;

              Y|y)quit=y;;
              *)clear
                sleep 1;;
           esac
         ;; #This one finishes off quit option.
         esac  # This one end case for registered user options
       ;; # This one end case for main menu #1
      2)clear
        echo "NETWORK CONNECTIVITY"
        echo "1. NIC Status"
        echo "2. Machine Availability
        echo "Which option do you require?"

        read menunumber2
        case $menunumber2 in

          1)clear
            echo "1. NIC Status"
            echo
            awk -F: '{print $1}' /etc/passwd
            echo
            echo "Hit the Enter Key to continue"
            read junk;;

          2)clear
            echo "2. Machine Availability"
            echo
            du
            echo
            echo "Hit Enter Key to continue"
            read junk;;

          Q|q)clear
            echo "Are you sure you want to quit? Y/N"
            read choice1
            case $choice1 in
                 N|n)clear
                     echo "Hit Enter Key to continue"
                     read junk;;

                 Y|y)quit=y;;
                 *)clear 
                   sleep 1;;
            esac
            ;; # This one finishes off quit option.
        esac # This one end case for network connectivity options
         ;; # This one end case for main menu #2

        3)echo Option 3 here...
          sleep 2
         ;;
        4)echo Option 4 here...
          sleep 2
         ;;
        5)echo Option 5 here...
          sleep 2
         ;;
        Q|q)echo "Quitting...finally"
          exit 0
          ;;
      esac
done
clear
echo "Thank you for using the Operator Administrative Tool"

 

10 More Discussions You Might Find Interesting

1. Programming

Calculate scores and probability -- Syntax issue

Hi, I am totally new to C programming on Sun Solaris environment. I am an active member on the UNIX forum and a good shell programmer. I am trying to achieve some calculations in C programming. I have the pseudo code written down but don't know the syntax. I am reading a couple of books on C... (4 Replies)
Discussion started by: madhunk
4 Replies

2. Shell Programming and Scripting

syntax issue in ksh file

Hi all, I am struck with syntax for long time, Need to purge some lines from given file Not able to use value of $x Example of ksh script... Facing some syntax issue. Have Tried ‘with single , double ,backtick “” ` and \ escape character , doesn't seem to work. <line 1> echo $x #... (2 Replies)
Discussion started by: manav666
2 Replies

3. Shell Programming and Scripting

Help with a possiable syntax issue in my script

Hello I have tried to my best ability to work around this script tht will reference my m-names.txt which contains the format of: 168.16.0.0/16 169.56.0.0/16 132.2.0.0/16 122.5.0.0/16 Then I call a cli named getzoneprof that will set the $subnet from each of the lines in the... (6 Replies)
Discussion started by: richsark
6 Replies

4. Shell Programming and Scripting

expr/bc syntax issue

Hi, I am facing issues in my shell script while trying to add two variables. Look at the snippet below for details: # Initially variable SAMPLE1 and SAMPLE2 are set from different sources. Have trucated decimal to avoid numeric errors in expr SAMPLE1=`/usr/bin/top -n 1 | head -3 | tail -1... (3 Replies)
Discussion started by: animesh303
3 Replies

5. Shell Programming and Scripting

Syntax error, not understanding the issue?

Close please. Refer to following thread: Sub Menu issues (2 Replies)
Discussion started by: Banned
2 Replies

6. Shell Programming and Scripting

syntax issue mysql in bash script

I'm running mysql in a bash script mysql <<EOF query EOF one query is like this: UPDATE $dbname.$prefix"config" SET value = $var WHERE "$prefix"config.name = 'table colname'; with variable but it's giving an error i'm not sure what to put for "$prefix"config.name the table... (3 Replies)
Discussion started by: vanessafan99
3 Replies

7. Shell Programming and Scripting

Syntax Issue

Hello all. Need a bit of help... I have : previous_tmp0=`cat tmp0.txt` previous_tmp1=`cat tmp1.txt` previous_tmp2=`cat tmp2.txt` previous_tmp3=`cat tmp3.txt` previous_tmp4=`cat tmp4.txt` previous_tmp5=`cat tmp5.txt` previous_tmp6=`cat tmp6.txt` previous_tmp7=`cat tmp7.txt` Now I... (5 Replies)
Discussion started by: Junaid Subhani
5 Replies

8. Shell Programming and Scripting

TCSH IF syntax issue

Hi All, I'm trying to write a simple if statement in TCSH and I honestly can't figure out what I'm doing wrong. I've played around with all sorts of permutations of syntax. if ($DESKTOP_SESSION == "kde") then replace "forceFontDPI=0" "forceFontDPI=96" --... (0 Replies)
Discussion started by: VerticalMule
0 Replies

9. Shell Programming and Scripting

Help in Understanding awk if ( F ) syntax -

Hi Experts, I was looking at the below link, for finding words next to it, And unable to understand this syntax: Can any one please explain , what is meaning of this code: if ( F ) s = s ? s OFS $i : $i from:... (4 Replies)
Discussion started by: rveri
4 Replies

10. Shell Programming and Scripting

Dpkg Syntax Issue . . .

Greetings! I'm trying to get dpkg to just completely extract a multi-part *.deb archive set into a single folder called "output". Simple? Hmmmm.... dpkg --noforce --unpack *.deb /output/Console after ops: However, "--noforce" is taken directly from the helpfile Options listing as furnished... (8 Replies)
Discussion started by: LinQ
8 Replies
DH_INSTALLMENU(1)						     Debhelper							 DH_INSTALLMENU(1)

NAME
       dh_installmenu - install Debian menu files into package build directories

SYNOPSIS
       dh_installmenu [debhelperoptions] [-n]

DESCRIPTION
       dh_installmenu is a debhelper program that is responsible for installing files used by the Debian menu package into package build
       directories.

       It also automatically generates the postinst and postrm commands needed to interface with the Debian menu package. These commands are
       inserted into the maintainer scripts by dh_installdeb(1).

FILES
       debian/package.menu
	   Debian menu files, installed into usr/share/menu/package in the package build directory. See menufile(5) for its format.

       debian/package.menu-method
	   Debian menu method files, installed into etc/menu-methods/package in the package build directory.

OPTIONS
       -n, --no-scripts
	   Do not modify postinst/postrm scripts.

SEE ALSO
       debhelper(7) update-menus(1) menufile(5)

       This program is a part of debhelper.

AUTHOR
       Joey Hess <joeyh@debian.org>

11.1.6ubuntu2							    2018-05-10							 DH_INSTALLMENU(1)
All times are GMT -4. The time now is 08:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy