Results 1 to 4 of 4

Thread: Bash case statement help on Ubuntu

  1. #1
    Join Date
    Jul 2009
    Posts
    43

    Bash case statement help on Ubuntu

    I am new to shell scripting. I have Ubuntu 9.04 and i am using it since a few weeks. I am learning shell scripts and need help with using Bash case statement help on Ubuntu linux. Can anyone help me with an example? Thanks!

  2. #2
    Join Date
    Jan 2009
    Posts
    710

    Re: Bash case statement help on Ubuntu

    The case statement is very smart replacement for if/then/else if/else statements when making comparisons in a large numbers. This command makes it easy for the user and script developer to create number of cases [choice] and edit it and make changes to the script without making too much changes. This works with all the shells, like bash, ssh, etc...

  3. #3
    Join Date
    Jul 2009
    Posts
    43

    Re: Bash case statement help on Ubuntu

    Thanks for the reply... But can anyone give me its syntax or an example so that i can understand it and implement it myself, so i could learn it quickly... Thanks in advance...

  4. #4
    Join Date
    Mar 2009
    Posts
    599

    Re: Bash case statement help on Ubuntu

    Syntax of Case Statement :

    Code:
    case "$var" in
    value1)
    commands;
    ;;
    value2)
    commands;
    ;;
    *)
    commands;
    ;;
    esac
    All the best and happy coding...

Similar Threads

  1. Case statement in oracle database
    By Kingfisher in forum Software Development
    Replies: 4
    Last Post: 04-03-2010, 10:21 PM
  2. Use the CASE Statement in a SQL SELECT Clause
    By Abraham.J in forum Software Development
    Replies: 3
    Last Post: 12-08-2009, 01:52 PM
  3. How to use SQL Case Statement Syntax
    By Suzane in forum Software Development
    Replies: 3
    Last Post: 30-07-2009, 02:47 PM
  4. Statement Parameter Slow in Stored Procedure case
    By HP_Crook in forum Software Development
    Replies: 3
    Last Post: 26-06-2009, 08:55 AM
  5. SWITCH....CASE statement in C#
    By Aadarsh in forum Software Development
    Replies: 1
    Last Post: 10-11-2008, 05:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,968,539.54187 seconds with 17 queries