Sponsored Content
Top Forums Shell Programming and Scripting Case statement in UNIX shell script Post 302967360 by rbatte1 on Tuesday 23rd of February 2016 07:29:03 AM
Old 02-23-2016
Could you write out the logical flow you are trying to achieve? It's all a bit confused and mixed up with which are variables and which are files. str3 is written to as a file and then you try to use it as a variable.

If you read in a variable fil and you are looking to test if it has a leading hyphen - then you can more simply do something like this:-

Code:
read "enter a file: "?fil
not_first="${fil#?}"              # Trim off first character from input
first="${fil%$notfirst}"          # Trim off all the other characters from input

case "$first" in.......


Does that help? If the statements don't make sense, then let me know and I will explain them.

Robin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script automation using case statement

Hi, I'm trying to write a shell script that has a menu and then dependant on the selection, will automate some samba file transfer. The problem is when I run the code without the case statement it runs fine. but when I put the case statement in the only way I can get the code to run is to... (6 Replies)
Discussion started by: ianf
6 Replies

2. 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

3. Shell Programming and Scripting

shell script case statement

In a case statement like below : case $rental in "car") echo "For $rental Rs.20 per k/m";; "van") echo "For $rental Rs.10 per k/m";; "jeep") echo "For $rental Rs.5 per k/m";; "bicycle") echo "For $rental 20 paisa per k/m";; *) echo "Sorry, I can not gat a $rental for you";;... (4 Replies)
Discussion started by: sriram003
4 Replies

4. UNIX for Dummies Questions & Answers

case statement in UNIX scripting (ksh)

Hi, I have a script like below : #!/bin/ksh echo "Do you want to export all docs ?" read alld echo "Do you want to export template or report only " read temr case && ] #arguments ;; case && ] #arguments ;; case && ] #arguments ;; (4 Replies)
Discussion started by: luna_soleil
4 Replies

5. Shell Programming and Scripting

Shell case statement

echo -e "Select: \c" read IN pattern="1-20" case $IN in ) echo "Selected: $IN" ;; *) echo "Invalid selection: $IN" ;; esac # sh test Select: 10 Invalid selection: 10 # sh test Select: 2 (6 Replies)
Discussion started by: Ikon
6 Replies

6. Shell Programming and Scripting

Trouble in getting user input while using CASE statement in UNIX

i want to get user input like this please tell which option to chose 1. mango 2. tango 3. rango if user chooses mango then it should execute a set of statements and again ask like this what do you want to do 1.add 2.subtract 3.exit when i choose exit it should goto my previous menu... (4 Replies)
Discussion started by: s.deepak
4 Replies

7. Shell Programming and Scripting

Help on case to call recursively in UNIX Shell Script

Hi, I am New to Unix Shell Scripting basically, i need some help in achieving a case statement in Shell script to call recursively That is if case having like 1 2 3 4 options , if user inputs 1 and gets executed case should ask for options again but user should not input the same input value 1,... (7 Replies)
Discussion started by: karthikram
7 Replies

8. Shell Programming and Scripting

Using shell to generate case statement

Hi Gurus, I have a very weird requirement and have no clue to resolve the issue. please help me get out this difficulty below two tables, table1 contains the column name. D means this column used for the rule. for example: rule 0 is all columns have value, rule1 is col3 and col7 have no value.... (2 Replies)
Discussion started by: Torhong
2 Replies

9. Shell Programming and Scripting

Shell scripting with case statement

Foe example we have three environments int,qa and prod.Each environment has some number of servers. int=Server1,Server2,Server3 qa=Server4,Server5,Server6 prod=Server7,Server8,Server9 echo "Enter the Environment i.e int,qa,prod" read env case $env in int) ## Need command where all the... (9 Replies)
Discussion started by: nareshreddy443
9 Replies

10. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
DateTime::Locale::fil(3)				User Contributed Perl Documentation				  DateTime::Locale::fil(3)

NAME
DateTime::Locale::fil SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'fil' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Filipino. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) Lunes Martes Miyerkules Huwebes Biyernes Sabado Linggo Abbreviated (format) Lun Mar Mye Huw Bye Sab Lin Narrow (format) L M M H B S L Wide (stand-alone) Lunes Martes Miyerkules Huwebes Biyernes Sabado Linggo Abbreviated (stand-alone) Lun Mar Mye Huw Bye Sab Lin Narrow (stand-alone) L M M H B S L Months Wide (format) Enero Pebrero Marso Abril Mayo Hunyo Hulyo Agosto Setyembre Oktubre Nobyembre Disyembre Abbreviated (format) Ene Peb Mar Abr May Hun Hul Ago Set Okt Nob Dis Narrow (format) E P M A M H H A S O N D Wide (stand-alone) Enero Pebrero Marso Abril Mayo Hunyo Hulyo Agosto Setyembre Oktubre Nobyembre Disyembre Abbreviated (stand-alone) Ene Peb Mar Abr May Hun Hul Ago Set Okt Nob Dis Narrow (stand-alone) E P M A M H H A S O N D Quarters Wide (format) Q1 Q2 Q3 Q4 Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) Q1 Q2 Q3 Q4 Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BCE CE Abbreviated BCE CE Narrow BCE CE Date Formats Full 2008-02-05T18:30:30 = Martes, Pebrero 05 2008 1995-12-22T09:05:02 = Biyernes, Disyembre 22 1995 -0010-09-15T04:44:23 = Sabado, Setyembre 15 -10 Long 2008-02-05T18:30:30 = Pebrero 5, 2008 1995-12-22T09:05:02 = Disyembre 22, 1995 -0010-09-15T04:44:23 = Setyembre 15, -10 Medium 2008-02-05T18:30:30 = Peb 5, 2008 1995-12-22T09:05:02 = Dis 22, 1995 -0010-09-15T04:44:23 = Set 15, -10 Short 2008-02-05T18:30:30 = 2/5/08 1995-12-22T09:05:02 = 12/22/95 -0010-09-15T04:44:23 = 9/15/-10 Default 2008-02-05T18:30:30 = Peb 5, 2008 1995-12-22T09:05:02 = Dis 22, 1995 -0010-09-15T04:44:23 = Set 15, -10 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = Martes, Pebrero 05 2008 18:30:30 UTC 1995-12-22T09:05:02 = Biyernes, Disyembre 22 1995 09:05:02 UTC -0010-09-15T04:44:23 = Sabado, Setyembre 15 -10 04:44:23 UTC Long 2008-02-05T18:30:30 = Pebrero 5, 2008 18:30:30 UTC 1995-12-22T09:05:02 = Disyembre 22, 1995 09:05:02 UTC -0010-09-15T04:44:23 = Setyembre 15, -10 04:44:23 UTC Medium 2008-02-05T18:30:30 = Peb 5, 2008 18:30:30 1995-12-22T09:05:02 = Dis 22, 1995 09:05:02 -0010-09-15T04:44:23 = Set 15, -10 04:44:23 Short 2008-02-05T18:30:30 = 2/5/08 18:30 1995-12-22T09:05:02 = 12/22/95 09:05 -0010-09-15T04:44:23 = 9/15/-10 04:44 Default 2008-02-05T18:30:30 = Peb 5, 2008 18:30:30 1995-12-22T09:05:02 = Dis 22, 1995 09:05:02 -0010-09-15T04:44:23 = Set 15, -10 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 Mar 1995-12-22T09:05:02 = 22 Bye -0010-09-15T04:44:23 = 15 Sab Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = Mar, 2-5 1995-12-22T09:05:02 = Bye, 12-22 -0010-09-15T04:44:23 = Sab, 9-15 MMM (LLL) 2008-02-05T18:30:30 = Peb 1995-12-22T09:05:02 = Dis -0010-09-15T04:44:23 = Set MMMd (MMM d) 2008-02-05T18:30:30 = Peb 5 1995-12-22T09:05:02 = Dis 22 -0010-09-15T04:44:23 = Set 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = Mar Peb 5 1995-12-22T09:05:02 = Bye Dis 22 -0010-09-15T04:44:23 = Sab Set 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = Pebrero 5 1995-12-22T09:05:02 = Disyembre 22 -0010-09-15T04:44:23 = Setyembre 15 MMMMEd (E MMMM d) 2008-02-05T18:30:30 = Mar Pebrero 5 1995-12-22T09:05:02 = Bye Disyembre 22 -0010-09-15T04:44:23 = Sab Setyembre 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (yyyy-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -010-9 yMEd (EEE, yyyy-M-d) 2008-02-05T18:30:30 = Mar, 2008-2-5 1995-12-22T09:05:02 = Bye, 1995-12-22 -0010-09-15T04:44:23 = Sab, -010-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 Peb 1995-12-22T09:05:02 = 1995 Dis -0010-09-15T04:44:23 = -10 Set yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = Mar, 2008 Peb 5 1995-12-22T09:05:02 = Bye, 1995 Dis 22 -0010-09-15T04:44:23 = Sab, -10 Set 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 Pebrero 1995-12-22T09:05:02 = 1995 Disyembre -0010-09-15T04:44:23 = -10 Setyembre yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyMM (yy-MM) 2008-02-05T18:30:30 = 08-02 1995-12-22T09:05:02 = 95-12 -0010-09-15T04:44:23 = -10-09 yyMMM (MMM yy) 2008-02-05T18:30:30 = Peb 08 1995-12-22T09:05:02 = Dis 95 -0010-09-15T04:44:23 = Set -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week Lunes SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::fil(3)
All times are GMT -4. The time now is 07:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy