AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
Expand all | Collapse all

guys can any help me answering this shell script error

  • 1.  guys can any help me answering this shell script error

    Posted Thu May 19, 2011 09:32 AM

    Originally posted by: rajeshw61


    i want to assign a series of names to a variable and use it for for loop can any one help me??

    ex:
    service='mark','frank','john' # is this possible? or is there some other method

    for i in $service
    do
    xyz....
    done
    #AIX-Forum


  • 2.  Re: guys can any help me answering this shell script error

    Posted Thu May 19, 2011 12:10 PM

    Originally posted by: shargus


    Yes.

    
    service=
    "mark frank john"   
    
    for name in $service 
    
    do echo $name done
    


    Note that all the names in service are in one quoted string, with a space between them.
    If you must use an array, it gets a bit more complicated...
    #AIX-Forum