SUMMARY: Help required writing a case statement

From: Hardy, Andrew (Andrew.Hardy_at_marks-and-spencer.com)
Date: 09/15/04

  • Next message: Sumeet Chandwani: "Format gives error Drive type unknown.."
    Date: Wed, 15 Sep 2004 15:44:33 +0100
    To: "sunmanagers" <sunmanagers@sunmanagers.org>
    
    

    All,

    Thanks to the following people for their unbelievably quick responses !!

    Jim Vandevegt
    Kevin Smith
    Gary Paveza
    Dale Hichert
    John Julian
    Reggie Beavers
    Lucien Hercaud
    Daniel Denes
    Mary Dell

    The reason it would not run, was down to my own stupidity !! When I
    specified the "read ANSWER", I had prefixed it with a $ (see below)
    Once I removed the dollar sign, it ran okay. Also, I had put esac on the
    end, but I forgot to paste it into my original email, but thanks for
    pointing it out anyway.

    print -n -- "PLEASE CHOOSE TO EITHER RELEASE ALL DRIVES OR BY AN
    INDIVIDUAL FRAME. ( FR1 / FR2 / ALL ) : > "

            read $ANSWER

    case $ANSWER in

            ALL|all) for drive in $ALL_DRIVE_LIST
                  do
                     echo ""
                     echo "****** Now releasing drive $drive ******"
                     echo ""
                    /usr/openv/volmgr/bin/vmoprcmd -crawlreleasebyname
    $drive
                done
            ;;
    esac

    Many Thanks for all your help

    Andy

    -----Original Message-----
    From: sunmanagers-bounces@sunmanagers.org
    [mailto:sunmanagers-bounces@sunmanagers.org] On Behalf Of Hardy, Andrew
    Sent: 15 September 2004 15:08
    To: sunmanagers
    Subject: Help required writing a case statement

    All,

    I am writing a script which requires me to embed a for loop within a
    case statement. I have had a go at doing it (sample of code below), but
    this does not run. However, the for loop on its own does run okay.

    Does anyone have any idea if this can be done & if so what's the best
    way to write it ?

    case $ANSWER in

            ALL) for drive in $ALL_DRIVE_LIST

    do
            echo ""
            echo "****** Now releasing drive $drive ******"
            echo ""
                    /usr/openv/volmgr/bin/vmoprcmd -crawlreleasebyname
    $drive
    done ;;

    Thanks in advance.

    Andy Hardy

            Andy Hardy
            Technical Specialist, Data Storage Services,
            Marks & Spencer PLC, 3 Longwalk Road,Room 1SW,
            Stockley Park, Uxbridge,Middesex,UB11 1AW.
            * 020 8718 5975
            * 07733 333324
    * mailto:andrew.hardy@marks-and-spencer.com

    -----------------------------------------------------------------------

    Registered Office:
    Marks and Spencer plc
    Waterside House
    35 North Wharf Road
    London
    W2 1NW

    Registered No. 214436 in England and Wales.

    Telephone (020) 7935 4422
    Facsimile (020) 7487 2670

    www.marksandspencer.com

    Please note that electronic mail may be monitored.

    This e-mail is confidential. If you received it by mistake, please let
    us know and then delete it from your system; you should not copy,
    disclose, or distribute its contents to anyone nor act in reliance on
    this e-mail, as this is prohibited and may be unlawful.

    The registered office of Marks and Spencer Financial Services PLC, Marks
    and Spencer Unit Trust Management Limited, Marks and Spencer Life
    Assurance Limited and Marks and Spencer Savings and Investments Limited
    is Kings Meadow, Chester, CH99 9FB. These firms are authorised and
    regulated by the Financial Services Authority.
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers

    -----------------------------------------------------------------------

    Registered Office:
    Marks and Spencer plc
    Waterside House
    35 North Wharf Road
    London
    W2 1NW

    Registered No. 214436 in England and Wales.

    Telephone (020) 7935 4422
    Facsimile (020) 7487 2670

    www.marksandspencer.com

    Please note that electronic mail may be monitored.

    This e-mail is confidential. If you received it by mistake, please let us know
    and then delete it from your system; you should not copy, disclose, or
    distribute its contents to anyone nor act in reliance on this e-mail, as this
    is prohibited and may be unlawful.

    The registered office of Marks and Spencer Financial Services PLC, Marks and
    Spencer Unit Trust Management Limited, Marks and Spencer Life Assurance
    Limited and Marks and Spencer Savings and Investments Limited is Kings Meadow,
    Chester, CH99 9FB. These firms are authorised and regulated by the Financial
    Services Authority.
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: Sumeet Chandwani: "Format gives error Drive type unknown.."

    Relevant Pages