2

This brace expression will generate a list of files:

$ touch {foo{.t,t.t},other.txt,test{,.{ascii,t{est.qt,x{t,xt}}}}} 

$ ls
foo.t foot.t other.txt test test.ascii test.test.qt test.txt test.txxt

Is it possible to convert back a list of files to a brace expansion?

4

With the list of files given above you just need to press ( M-{ ) in an empty command line:

Alt - {

to get:

$ {foo{.t,t.t},other.txt,test{,.{ascii,t{est.qt,x{t,xt}}}}}

Or, write fo and press the same keys to get:

$ foo{.t,t.t}

That is, complete into braces all files that match the string fo (before point).

From man bash

complete-into-braces (M-{)
Perform filename completion and insert the list of possible completions enclosed within braces so the list is available to the shell.

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.