Getting an arbitary item from a list

    This script gets the specified element form the list on the command line...

    #!/bin/bash
    
    # Select a specified item from a list. Copyright (c) Michael Still 2002
    # Released under the terms of the GNU GPL
    
    # $1 is the number to get, $* except for $1 is the list of options, delimited
    # by a space each
    
    # We can the shift operation to get to the right number
    shift $1
    echo $1
    


posted at: 04:00 | path: /bashrand | permanent link to this entry



    Add a comment to this post:

    Your name:

    Your email: Email me new comments on this post
      (Your email will not be published on this site, and will only be used to contact you directly with a reply to your comment if needed. Oh, and we'll use it to send you new comments on this post it you selected that checkbox.)


    Your website:

    Comments:


    Because of excessive load, this site is generated statically every several hours. Therefore, your comment may take some time to appear here. Unless you get an error message when you click the select button below, then all is normal and the comment will appear in due course. If you want you can checkout all recently approved comments while your waiting.