Skip to main content
Tweeted twitter.com/ServerFault/status/959714474541412357

In BASHBash, are wildcard expansions guaranteed to be in order?

Is the expansion of a wildcard in BASHBash guaranteed to be in alphabetical order? I am forced to split a large file into 10Mb pieces10 Mb pieces so that they can be be accepted by my Mercurial repository.

So I was thinking I could use:

split -b 10485760 Big.file BigFilePiece.

and then in place of:

cat BigFile | bigFileProcessor

I could do:

cat BigFilePiece.* | bigFileProcessor

Inin its place.

However, I could not find anywhere that guaranteed that the expansion of the asterisk (aka wildcard, aka '*' *) would always be in alphabetical order so that .aa.aa came before .ab.ab ( asas opposed to be timestamp ordering or something like that  ).

Also, are there any flaws in my plan? How great is the performance cost of cating the file together?

In BASH, are wildcard expansions guaranteed to be in order?

Is the expansion of a wildcard in BASH guaranteed to be in alphabetical order? I forced to split a large file into 10Mb pieces so that they can be be accepted by my Mercurial repository.

So I was thinking I could use:

split -b 10485760 Big.file BigFilePiece.

and then in place of:

cat BigFile | bigFileProcessor

I could do:

cat BigFilePiece.* | bigFileProcessor

In its place.

However, I could not find anywhere that guaranteed that the expansion of the asterisk (aka wildcard, aka '*' ) would always be in alphabetical order so that .aa came before .ab ( as opposed to be timestamp ordering or something like that  ).

Also, are there any flaws in my plan? How great is the performance cost of cating the file together?

In Bash, are wildcard expansions guaranteed to be in order?

Is the expansion of a wildcard in Bash guaranteed to be in alphabetical order? I am forced to split a large file into 10 Mb pieces so that they can be be accepted by my Mercurial repository.

So I was thinking I could use:

split -b 10485760 Big.file BigFilePiece.

and then in place of:

cat BigFile | bigFileProcessor

I could do:

cat BigFilePiece.* | bigFileProcessor

in its place.

However, I could not find anywhere that guaranteed that the expansion of the asterisk (aka wildcard, aka *) would always be in alphabetical order so that .aa came before .ab (as opposed to be timestamp ordering or something like that).

Also, are there any flaws in my plan? How great is the performance cost of cating the file together?

Source Link
Sled
  • 937
  • 1
  • 7
  • 11

In BASH, are wildcard expansions guaranteed to be in order?

Is the expansion of a wildcard in BASH guaranteed to be in alphabetical order? I forced to split a large file into 10Mb pieces so that they can be be accepted by my Mercurial repository.

So I was thinking I could use:

split -b 10485760 Big.file BigFilePiece.

and then in place of:

cat BigFile | bigFileProcessor

I could do:

cat BigFilePiece.* | bigFileProcessor

In its place.

However, I could not find anywhere that guaranteed that the expansion of the asterisk (aka wildcard, aka '*' ) would always be in alphabetical order so that .aa came before .ab ( as opposed to be timestamp ordering or something like that ).

Also, are there any flaws in my plan? How great is the performance cost of cating the file together?