Results 1 to 5 of 5

Thread: Wildcards

  1. #1

    Default Wildcards

    What are the bash wildcards? (e.g *,?...)

  2. #2

    Default Re: Wildcards

    Using bash wildcards

    I bookmark for future reference, because my memory is like 64k.

  3. #3
    ab@novell.com NNTP User

    Default Re: Wildcards

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    That's fair... it's all the memory you'll ever need.... or so he says.

    Good luck.





    giaslamo wrote:
    > 'Using bash wildcards'
    > (http://www.shell-tips.com/2006/11/04...ash-wildcards/)
    >
    > I bookmark for future reference, because my memory is like 64k.
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFIse3N3s42bA80+9kRAto5AJ96tLtV5mj4N+JI2dysY1XheiRA/gCfVDYe
    VFQMw6rvymUNa2vttHP4OKQ=
    =9FBQ
    -----END PGP SIGNATURE-----

  4. #4
    Join Date
    Aug 2008
    Location
    East England
    Posts
    50

    Default Re: Wildcards

    There are quite a few options for wildcards in Bash. I'm not sure how comprehensive this list is, but it's at least a starting point:

    * (asterisk) zero or more characters

    ? (question mark) one character

    [abcde] - any one of the character from the contents of square brackets

    [a-e] - any one character in the range defined either side of the dash within square brackets

    [!abcde] or [!a-e] modifies the two previous examples with "not"

    {suse,linux} any one string from the options listed in curly brackets

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Wildcards

    Strictly speaking that last one {suse,linux} isn't a wildcard but brace expansion. What is the difference? Brace expansion works even if there is no match. Say you have file1 and file3 in a directory.

    echo file[1-3]

    will get you file1 file3, but

    echo file{1,2,3}

    will get you file1 file2 file3

    You can read all about brace expansion in the man page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •