Sponsored Content
Full Discussion: Help needed in Switch Case
Top Forums Shell Programming and Scripting Help needed in Switch Case Post 302266557 by spkandy on Wednesday 10th of December 2008 02:03:15 PM
Old 12-10-2008
Bug Help needed in Switch Case

Hi Experts team,
i wish to use switch case in unix.
my req is

case $code in
1111)
echo "1111"
1112)
echo "1112"
*)
echo "default"
esac

see eventhough for particular case 1111 , it is always execute the default statement *), if i code like this.

How can handle numeric values in switch case in shell scripts.
Please explain

Thanks a lot 8)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ignore case sensitive in Case Switch

In a Case switch, how to ignore case sensitive in the test: e.g. case "$field" in "TEST) action1;; *) action2;; esac How to go in action1 in case of $field = TEST , or Test , or test or .... without enumerating all possibilities... Thanks,... (1 Reply)
Discussion started by: annelisa
1 Replies

2. Shell Programming and Scripting

Script needed to select and delete lower case and mixed case records

HELLO ALL, URGENTLY NEEDED A SCRIPT TO SELECT AND DELETE LOWER AND MIXED CASE RECORDS FROM A COLUMN IN A TABLE. FOR EXAMPLE : Table name is EMPLOYEE and the column name is CITY and the CITY column records will be: Newyork washington ... (1 Reply)
Discussion started by: abhilash mn
1 Replies

3. Shell Programming and Scripting

Help needed in switch case handling in UNIX

Hi, In below code, i am expecting the output has Bye Bye But i am getting has Bye Hi Code: #!/usr/bin/bash var="Hi" cat txt.txt | while read var1 do next="Bye" case $var in Hi) (1 Reply)
Discussion started by: Balamani
1 Replies

4. Shell Programming and Scripting

Example of switch case in Bash

can anyone post a sample code for a switch case in shell (1 Reply)
Discussion started by: sumit the cool
1 Replies

5. Shell Programming and Scripting

Something is wrong with this switch( case statement.

I started writing a script to save the files from a camera I got the other day, which mounts in /Volumes , and I got into it and started building this menu. The only problem is that the switch case is coming up as a syntax error at the parenthesis after a case. Here is the code: while : do ... (2 Replies)
Discussion started by: snakemasterAK
2 Replies

6. Shell Programming and Scripting

Switch Case not working

My switch case is not working properly. When I press 6 or 'r' it prints out all the names of the project and the error message. #!/bin/bash while true; do read -p "Enter project number (1/2/3/10/20/30):" menu #grabs the informations of the project number and stores it into a menu... (1 Reply)
Discussion started by: Rapcher
1 Replies

7. Shell Programming and Scripting

Error while executing switch case for find and replace specific file. Help Me...

case "$inputs" in sapte) find /pools/home_unix/sapte/work/models/model -name "*.xml" exec rm -i {} \;; ckm1) find /pools/home_unix/ckm1/work/models/model -name "*.xml" exec rm -i {} \;; I am getting error like as below. ./menu1.sh: line 144: syntax error near unexpected token `)'... (4 Replies)
Discussion started by: lathigara
4 Replies

8. Programming

Passing arguments from command line to switch case statement in C

Hi Am pretty new to C.. Am trying to pass the arguments from command line and use them in switch case statement.. i have tried the following #include <stdlib.h> main(int argc, char* argv) { int num=0; if ( argc == 2 ) num = argv; printf("%d is the num value",num); switch ( num ) ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

9. Shell Programming and Scripting

Help needed in case

Hi All, I have a requirement to write shell script in which we have to test three cases considering ip connection which differentiate the tool's name as per as the ip address in the file.txt . <ip1>,<ip2>,<ip3> address belongs to Tool1 <ip4>,<ip5>,<ip6> address belongs to Tool2 if... (12 Replies)
Discussion started by: netdbaind
12 Replies

10. Shell Programming and Scripting

Why does it not work (Switch Case)?

Hi there, I'm trying to run a simple script,but i'm always getting this error Syntax error: word unexpected (expecting "in")I have searched many sites,like this,but i dont get it,it looks good so far,but wont work,maybe someone can help me. Here is the Script #!/bin/bash while : do... (6 Replies)
Discussion started by: JustAnUser
6 Replies
Vend::Payment::ECHO(3pm)				User Contributed Perl Documentation				  Vend::Payment::ECHO(3pm)

NAME
Vend::Payment::ECHO - Interchange ECHO Support AUTHOR
Michael Lehmkuhl <michael@electricpulp.com>. Ported to Vend::Payment by Dan Browning <db@kavod.com>. Code reused and inspired by Mike Heins <mike@perusion.com>. SPECIAL THANKS
Jim Darden <support@openecho.com>, Dan Browning <db@kavod.com> SYNOPSIS
&charge=echo or [charge mode=echo param1=value1 param2=value2] PREREQUISITES
If you have not done so already, you will need to sign up for an ECHO account. You will be provided an ID and a PIN (also known as 'secret'). You may also sign up for a test account at the following URL: http://www.echo-inc.com/echotestapp.php This subroutine uses the OpenECHO module. Make sure OpenECHO.pm is in your @INC array. It is available for download, see the following URLs: http://www.openecho.com/ http://www.echo-inc.com/ The OpenECHO.pm module itself has some additional prerequisites: Net::SSLeay or LWP::UserAgent and Crypt::SSLeay Only one of these need be present and working. Net::SSLeay is preferred as some have reported problems using LWP::UserAgent and Crypt::SSLeay. URL::Escape This module is used to write some of the URLs used by the OpenECHO module. It is recommended that you read the documention for the OpenECHO module itself in addition to this document. DESCRIPTION
The Vend::Payment::ECHO module implements the echo() routine for use with Interchange. It is compatible on a call level with the other Interchange payment modules. To enable this module, place this directive in "interchange.cfg": Require module Vend::Payment::ECHO This must be in interchange.cfg or a file included from it. NOTE: Make sure CreditCardAuto is off (default in Interchange demos). The mode can be named anything, but the "gateway" parameter must be set to "echo". To make it the default payment gateway for all credit card transactions in a specific catalog, you can set in "catalog.cfg": Variable MV_PAYMENT_MODE echo It uses several of the standard settings from Interchange payment. Any time we speak of a setting, it is obtained either first from the tag/call options, then from an Interchange order Route named for the mode, then finally a default global payment variable, For example, the "id" parameter would be specified by: Route echo id Your_ECHO_ID or (with only ECHO as a payment provider) Variable MV_PAYMENT_ID Your_ECHO_ID or Variable ECHO_PAYMENT_ID Your_ECHO_ID or [charge mode=echo id=Your_ECHO_ID] The active settings are: id Your account ID, supplied by ECHO when you sign up. Global parameter is MV_PAYMENT_ID or ECHO_PAYMENT_ID. secret Your account password, selected by you or provided by ECHO when you sign up. Global parameter is MV_PAYMENT_SECRET or ECHO_PAYMENT_SECRET. others... If planning to do AUTH_ONLY or other with special admin page Variable MV_PAYMENT_REMAP order_id=mv_order_id auth_code=mv_auth_code Variable ECHO_PAYMENT_ORDER_TYPE S # S for "self-service" orders # F for hosted or ISP orders Variable ECHO_PAYMENT_ISP_ECHO_ID 123<4567890 Variable ECHO_PAYMENT_ISP_PIN 12345608 Variable ECHO_PAYMENT_MERCHANT_EMAIL merchant@merchant.com Variable ECHO_PAYMENT_DEBUG F # C causes ECHO to return a statement of conformity # T or TRUE causes ECHO to return additional debug information # Any other value turns off ECHO debugging Example Configuration This is an example configuration that one would add to catalog.cfg: Variable MV_PAYMENT_ID Your_ECHO_ID Variable MV_PAYMENT_SECRET Your_ECHO_secret Variable MV_PAYMENT_MODE echo Troubleshooting Try a sale with the card number "4111 1111 1111 1111" and a valid expiration date. The sale should be denied, and the reason should be in [data session payment_error]. If nothing works: o Make sure you "Require"d the module in interchange.cfg: Require module Vend::Payment::ECHO o Make sure the ECHO "OpenECHO.pm" module is available either in your path or in /path_to_interchange/lib. o Check the error logs, both catalog and global. o Make sure you set your account ID and secret properly. o Try an order, then put this code in a page: <XMP> [calc] my $string = $Tag->uneval( { ref => $Session->{payment_result} }); $string =~ s/{/{ /; $string =~ s/,/, /g; return $string; [/calc] </XMP> That should show what happened. o If all else fails, Interchange consultants are available to help with integration for a fee. SECURITY CONSIDERATIONS
Because this library calls an executable, you should ensure that no untrusted users have write permission on any of the system directories or Interchange software directories. NOTES
There is actually nothing *in* Vend::Payment::ECHO. It changes packages to Vend::Payment and places things there. perl v5.14.2 2011-03-09 Vend::Payment::ECHO(3pm)
All times are GMT -4. The time now is 09:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy