
Brace yourself, I’m in an expansive mood (2019) - arm
https://leancrew.com/all-this/2019/09/brace-yourself-im-in-an-expansive-mood/
======
pkrumins
I once saw and saved this snippet that prints 30 English words:

    
    
        echo {w,t,}h{e{n{,ce{,forth}},re{,in,fore,with{,al}}},ither,at}

------
hyperpallium
brace expansion is also useful for renaming/changing hierarchies:

    
    
      mv topo{lo,raph}ical.data
      mv proj/src/{main,test}/com/org/proj/Test.java

~~~
lonelappde
How can that work?

~~~
hyperpallium
Actually, the first one does need the _g_ , should be

    
    
      mv topo{log,graph}ical.data
    

It works because it expands to

    
    
      mv topological.data topographical.data
    

try it with _echo_ instead of _mv_ to see how it expands. Other uses:

    
    
      mv myfile.txt{,.tmp}   # add extension
      mv mymusic.{mp3,mp4}   # change extension
      mv myarchive.{zip,jar}

------
smitty1e
Outstanding title, both topical and unexpected.

