In bash is there a way to preview (and/or expand) curly braces when used in arguments (I'd prefer preview but if that's not possible, then expanding would be okay)? I know you can do it with filenames and wildcards by pressing ESC + ?, but what if it's not actual files and simply arguments that you want expanded or to preview the expansion of?

For example, if touch {a,b}{1,2} is entered at the prompt, is there some way to preview that that will expand out to a1 a2 b1 b2 (in whatever order it would expand out to).


Simple: Use echo.

$ echo touch {a,b}{1,2}
touch a1 a2 b1 b2
  • 1
    +1 for a creative solution. I can't help but wonder if there's a native way though. – sa289 Oct 2 '15 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.