Hacker News new | past | comments | ask | show | jobs | submit login
Brace yourself, I’m in an expansive mood (2019) (leancrew.com)
34 points by arm 38 days ago | hide | past | web | favorite | 5 comments

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}

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

How can that work?

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}

Outstanding title, both topical and unexpected.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact