Brocade Fibre Channel Networking Community

Expand all | Collapse all

Is it possible to generate a list of port numbers to use with a for loop construct

Jump to Best Answer
  • 1.  Is it possible to generate a list of port numbers to use with a for loop construct

    Posted 11-27-2013 08:37 AM

    I would like to something along these lines:

    for idx in `echo {0..10}`

     

    or

     

    for idx in `seq 0 10 `

     

    but the cli shell does not recognize these constructs.

     

    any ideas other than

     

    for idx in 0 1 2 3 4 5 6 7  8 9 10


    #BrocadeFibreChannelNetworkingCommunity


  • 2.  Re: Is it possible to generate a list of port numbers to use with a for loop construct

    Posted 11-27-2013 09:21 AM

    sansw:root> for I in `seq 0 4`; do echo $I; done
    0
    1
    2
    3
    4
    sansw:root>

     

    Works for me  (FOS6.2something).

    Please observe I logged on as root, which is unrestricted in its shell, were other users have an restricted shell.


    #loop
    #unrestricted
    #BrocadeFibreChannelNetworkingCommunity
    #shell
    #restricted


  • 3.  Re: Is it possible to generate a list of port numbers to use with a for loop construct

    Posted 11-29-2013 09:06 AM

    I was interested in doing this as Admin,  I would like to get a list of portnames for all ports via something like this:

    for idx in `seq 0 79`

    do

    portname -i $idx

    done

     

    This doesn't appear to work when logged in as admin.  


    #BrocadeFibreChannelNetworkingCommunity


  • 4.  Re: Is it possible to generate a list of port numbers to use with a for loop construct
    Best Answer

    Posted 11-29-2013 09:33 AM

    Like i said in my previous reply.

     

    root has an unrestricted shell.

    Admin users are restricted.

    Factory doesn't seem to fit the bill.

     

    If you can't use the root user, you can't use those commands on a switch and need to think of an alternative like expect.

    Alternatively you can try to create you're own unrestricted user por alter an existing one.


    #expect
    #defaultuser
    #unrestricted
    #restricted
    #shell
    #BrocadeFibreChannelNetworkingCommunity
    #user