Brace yourself, I’m in an expansive mood (2019)

(leancrew.com)

34 points | by arm 1518 days ago

3 comments

  • pkrumins 1517 days ago
    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 1517 days ago
    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 1517 days ago
      How can that work?
      • hyperpallium 1517 days ago
        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 1517 days ago
    Outstanding title, both topical and unexpected.