Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Bash brace expansion with range of numbers

  • 13-10-2005 3:44pm
    #1
    Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭


    One can use bash's brace expansion to do less typing.
    Eg:
    [din][~]$ echo foo{0,1,2,3,4,5,6}
    foo0 foo1 foo2 foo3 foo4 foo5 foo6
    

    However I'm conviced I can remember doing something like this:
    [din][~]$ echo foo{0..6}
    foo0 foo1 foo2 foo3 foo4 foo5 foo6
    

    And FYI:
    [din][~]$ bash --version
    bash --version
    GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0)
    Copyright (C) 2002 Free Software Foundation, Inc.
    


Comments

  • Registered Users, Registered Users 2 Posts: 413 ✭✭padraigmyers


    Works fine for me, although i do have a much newer version of bash.
    [~ 17:21:30]$ echo foo{0..6} 
    foo0 foo1 foo2 foo3 foo4 foo5 foo6 
    
    [~ 17:22:15]$ bash --version 
    GNU bash, version 3.00.16(1)-release (i386-redhat-linux-gnu) 
    Copyright (C) 2004 Free Software Foundation, Inc
    


  • Closed Accounts Posts: 96 ✭✭krinDar


    Syth wrote:
    However I'm conviced I can remember doing something like this:
    [din][~]$ echo foo{0..6}
    foo0 foo1 foo2 foo3 foo4 foo5 foo6
    


    This feature was added in version 3.0 of bash:

    http://cnswww.cns.cwru.edu/~chet/bash/NEWS

    Look for 'u' under new features.


  • Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭Syth


    I updated bash (via darwin ports). I'm using v3 now. I'm happy. :D

    Thanks lad{,ettes}s. ;)


Advertisement