Sponsored Content
Full Discussion: Problem with CASE statement
Top Forums Shell Programming and Scripting Problem with CASE statement Post 302395539 by raghunsi on Tuesday 16th of February 2010 10:54:55 AM
Old 02-16-2010
Johnson,

But still script's third argument {enable or disable} is not working !! Im feeling i need to insert OPTARGS for this purpose.

Please check this output of the script:

Code:
$ ./routing.sh xyz123-ra  str enable or disable

**********************************************************
 Preparing to service the request for  Device xyz123-ra in Question
**********************************************************

 Setting right http Proxy configuration
 Report Logging . .

 Tue Feb 16 07:47:24 CST 2010

 FILE CREATED:  /home/jg355187/out/outFile100216-074724.xyz123-ra.enable

 Global configuration mode
 Modify Firewall Service configuration
 admin-state enabled
 Configuration saved successfully.
 Goodbye

**********************************************************

This part of the code is not functioning Properly

Code:
##############################################

printf "%s\n" "admin
passwd
clock
switch Services
config
xmlfirewall Firewall
admin-state ${STATE}
show
exit
write memory
y
exit
exit" > "$INFILE"
}

##################################################

Check the input parameters
#
   case $2 in

         stp)
            Firewall disabled
            echo " Changing the http Proxy configuration "
        ;;
         str)
            Firewall enabled
            echo " Setting right http Proxy configuration "
        ;;
         disable)
                Traffic_Router disabled
                echo " Disabling the Device in few seconds "
        ;;
          enable)
                Traffic_Router enabled
                echo " Enabling the Device in few seconds "
        ;;

###################################################

The highlighted part of the CASE statement is very much needed here in this script, the purpose of this building the script is based on Traffic Routing which is not functioning properly. Do let me know whether my idea of inserting OPTRAGS is legible or not ??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

case statement

Hi all, is it possible to create a 'dynamic' case statement. ie select option in `ls` do case satement depending on results of the above `ls` done I hope I have explained this ok! Thanks Helen (1 Reply)
Discussion started by: Bab00shka
1 Replies

2. UNIX for Advanced & Expert Users

Case statement problem

I need to display this menu and accept variables. Can someone tell me why i am having a problem with this case statement, please # TAPE MANAGER MAIN MENU tapemgr_Main_Menu() { echo "Legato Tape Management System Menu" echo " This system is used to report Legato ERV Offsite and Tapes... (6 Replies)
Discussion started by: gzs553
6 Replies

3. Shell Programming and Scripting

what is problem with this small shell script.. case statement related

Hi All, this small script is written to recognize user input character.. it is in small case .. upeer case or is a number... but when i input first capital letter say A.. it always gives small character.... what is the problem. #!/bin/bash echo "Enter the character" read a case $a in )... (2 Replies)
Discussion started by: johnray31
2 Replies

4. Shell Programming and Scripting

case statement

Hi all, I think i'm asking a sqtupid question here.. i'm using case sttament, what is the syntax or symbol for "or"? I thought was || here a quick sample of my case statment echo "Would you like to update your detail ?" read response case $response in ... (2 Replies)
Discussion started by: c00kie88
2 Replies

5. Shell Programming and Scripting

Problem with case statement

Hi, I need modify the all lines in a file into one format. cat file htec.twe34c.ATI .hesh.twdghu..ATI ..hesh.twdghu..ATI htec.twe3 hjsct14567ati Output should have 16 characters htectwe34c ATI heshtwdghu ATI heshtwdghu ATI htectwe3 ATI hjsct14567 ATI (4 Replies)
Discussion started by: kartheek
4 Replies

6. Shell Programming and Scripting

Problem using 'Case' statement

Hi, When I execute the below script, I am getting the error as ' is not expected.ror at line 3 : `in #!/bin/sh case $1 in -r) echo Force deletion without confirmation ;; -i) echo Confirm before deleting ;; *) echo Unknown argument ;; esac I could not see any problem with... (1 Reply)
Discussion started by: Sathish_Obla
1 Replies

7. Homework & Coursework Questions

Problem with executing a possible if or case statement script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a phonebook program. It should use functions to perform the required tasks. It should be menu-based,... (1 Reply)
Discussion started by: Rgasin02
1 Replies

8. Shell Programming and Scripting

Problem using bash case statement

I have the following bash script and it is not accepting the lines "--"|"--""-") "--""-"") while do echo "Current Argument is ${1}" case "$1" in "--"|"--""-") echo "Argument is ${1}" shift # Skip ahead one to the next argument. ... (1 Reply)
Discussion started by: kristinu
1 Replies

9. Homework & Coursework Questions

Case Statement

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hey, guys I really need some help with a project. "Write a shell program that examines the command line... (8 Replies)
Discussion started by: sk192010`
8 Replies

10. Shell Programming and Scripting

[Solved] Strange Problem in case statement while shift

Hi, Here is my code as below: test.ksh: ======= #!/bin/ksh option="${1}" while do case $1 in -f) FILE="${2}" echo "File name is $FILE" ;; -d) DIR="${2}" echo "Dir name is $DIR" ;; -*) echo "`basename ${0}`:usage: | " (5 Replies)
Discussion started by: zaq1xsw2
5 Replies
asadmin-enable(1AS)						   User Commands					       asadmin-enable(1AS)

NAME
asadmin-enable, enable - enables the component SYNOPSIS
enable --user admin_user [--password admin_password][--host localhost] [--port 4848] [--secure|-s]--passwordfile filename [--terse=false][--echo=false] [--interactive] component_name enable command enables the specified component. If the component is already enabled, then it is re-enabled. The component must have been deployed in order to be enabled. If it has not been deployed, then an error message is returned. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. --echo setting to true will echo the command line statement on the standard output. --interactive prompts you for the required options that are not already specified. OPERANDS
component_name name of the component to be enabled. Example 1: Using enable asadmin> enable sampleApp Command enable executed successfully EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-deploy(1AS), asadmin-deploydir(1AS), asadmin-undeploy(1AS), asadmin-disable(1AS) J2EE 1.4 SDK March 2004 asadmin-enable(1AS)
All times are GMT -4. The time now is 09:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy