Sponsored Content
Top Forums Shell Programming and Scripting Not able to exit from case statements Post 302366142 by panyam on Thursday 29th of October 2009 02:19:30 AM
Old 10-29-2009
Even

Code:
if [ opt -eq "yes" ]

should be

Code:
if [ $opt =  "yes" ]

Make sure that variables always should have "$" as prefix when used in any expressions.

Last edited by panyam; 10-29-2009 at 03:43 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Where can I find a list of exit codes? (Exit code 64)

I'm receiving an exit code 64 in our batch scheduler (BMC product control-m) executing a PERL script on UX-HP. Can you tell me where I can find a list of exit codes and their meaning. I'm assuming the exit code is from the Unix operating system not PERL. (3 Replies)
Discussion started by: jkuchar747
3 Replies

2. Shell Programming and Scripting

case statements

i need to use a case statement to do something when the user enters nothing at the prompt. i know about the if statement and that isnt' what i'm interested in using for this. i want to use case. heres the scenerio. a program asks a user for an input. i want to use a case statement to... (1 Reply)
Discussion started by: Terrible
1 Replies

3. Shell Programming and Scripting

Problem with my case statements

Hi there, Im having some problems with this function, I pass two arguments to the function $1 $2 (Arguments are month and date inputted by the user) for some reason the case always fails... however in the cases defined below where it shouldnt fail the result is: if it fails with input... (6 Replies)
Discussion started by: Darklight
6 Replies

4. UNIX for Dummies Questions & Answers

How to combine case statements

Hi, I need to change military time to regular time. I know to use case to indicate whether a.m. or p.m. as follows: case "$hour" in 0? | 1 ) echo a.m.;; 1 ) echo p.m.;; * ) echo p.m.;; esac My question is how do I add the hour and minute... (2 Replies)
Discussion started by: karp3158
2 Replies

5. Shell Programming and Scripting

exit from case - called in a function

Hello Experts, I am building a shell where I need to use case structure. The structure is in a function as in the sample code below: # Shell mySh #!/bin/sh doThis(){ var=$1 case "$var" in IT) echo "ok 1 $var" ;; ... (7 Replies)
Discussion started by: hkansal
7 Replies

6. Shell Programming and Scripting

Help with case and exit

Hi all, Am writing a script that uses the case statement and it is not working the way that I expect it to be. Script so far is as below. What am expecting to happen is if the user enter neither Y or YES or N or NO, it is supposed to exit out of the script running only on_exit, otherwise,... (3 Replies)
Discussion started by: newbie_01
3 Replies

7. UNIX for Dummies Questions & Answers

Handling return & exit statements

I have 2 shell scripts the primary one would load the other one which will have functions defined in it. Script 1: . /apps/bin/Script 2 function if then continue... .... fi Script 2: function() (10 Replies)
Discussion started by: Ariean
10 Replies

8. Homework & Coursework Questions

Case statements and creating a file database

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: The assignment is posted below: Maintain automobile records in a database Write a shell script to create,... (1 Reply)
Discussion started by: Boltftw
1 Replies

9. Shell Programming and Scripting

Convert to case statements from if/elif

Hello, I wrote the case on code but it mistakes. I am not sure. If/elif code: #!/bin/ksh you=$LOGNAME hour=`date | awk '{print substr($4, 1, 2)}'` print "The time is: $(date)" if (( hour > 0 && $hour < 12 )) then print "Good morning, $you!" elif (( hour == 12 )) then (7 Replies)
Discussion started by: Masterpoker
7 Replies

10. Shell Programming and Scripting

Searching for pattern in variable using case statements

i would like to search a variable for a pattern, without having make any calls to external tools. i have a code like this: COUNTPRO2="gine is very bad vine is pretty good" case "${COUNTPRO2}" in *vine*) factor=${COUNTPRO2} echo $factor ;; esac If the variable contains... (7 Replies)
Discussion started by: SkySmart
7 Replies
Locale::Codes::LangVar(3pm)				 Perl Programmers Reference Guide			       Locale::Codes::LangVar(3pm)

NAME
Locale::Codes::LangVar - standard codes for language variation identification SYNOPSIS
use Locale::Codes::LangVar; $lvar = code2langvar('acm'); # $lvar gets 'Mesopotamian Arabic' $code = langvar2code('Mesopotamian Arabic'); # $code gets 'acm' @codes = all_langvar_codes(); @names = all_langvar_names(); DESCRIPTION
The "Locale::Codes::LangVar" module provides access to standard codes used for identifying language variations, such as those as defined in the IANA language registry. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default IANA language registry codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying language variations. A code set may be specified using either a name, or a constant that is automatically exported by this module. For example, the two are equivalent: $lvar = code2langvar('en','alpha-2'); $lvar = code2langvar('en',LOCALE_CODE_ALPHA_2); The codesets currently supported are: alpha This is the set of alphanumeric codes from the IANA language registry, such as 'arevela' for Eastern Armenian. This code set is identified with the symbol "LOCALE_LANGVAR_ALPHA". This is the default code set. ROUTINES
code2langvar ( CODE [,CODESET] ) langvar2code ( NAME [,CODESET] ) langvar_code2code ( CODE ,CODESET ,CODESET2 ) all_langvar_codes ( [CODESET] ) all_langvar_names ( [CODESET] ) Locale::Codes::LangVar::rename_langvar ( CODE ,NEW_NAME [,CODESET] ) Locale::Codes::LangVar::add_langvar ( CODE ,NAME [,CODESET] ) Locale::Codes::LangVar::delete_langvar ( CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_alias ( NAME ,NEW_NAME ) Locale::Codes::LangVar::delete_langvar_alias ( NAME ) Locale::Codes::LangVar::rename_langvar_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::add_langvar_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Codes::LangVar::delete_langvar_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes::API man page. SEE ALSO
Locale::Codes The Locale-Codes distribution. Locale::Codes::API The list of functions supported by this module. http://www.iana.org/assignments/language-subtag-registry The IANA language subtag registry. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 2011-2012 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-10-11 Locale::Codes::LangVar(3pm)
All times are GMT -4. The time now is 10:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy