Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 2
    1 - try *.{jpg,jpeg,txt,dummy} -- 2 - in your sample, you'll generate test1.done from test.jpg and test1.done from test1.jpeg. Commented Apr 15, 2015 at 10:23
  • 1
    Please edit your question and show us your desired output. I can't understand if you want to have the extensions in an array or if you just want to change the extension of all files to .done. Commented Apr 15, 2015 at 10:30
  • 1
    @terdon it looks like the OP means list where they've written array. They them go on to say they've tried *{.jpg,.jpeg,.txt,.dummy} so I wonder if it's an older shell that doesn't understand the {x,y,z} type construct. Commented Apr 15, 2015 at 10:34
  • 1
    @roaima perhaps, this is CentOS after all. Still, we can't provide an answer unless the question is clarified. The simple answer of course is that brace expansion is not needed at all: for f in *jpg *jpeg *txt *dummy; do.... For more details, we need to understand exactly what the OP is attempting. Commented Apr 15, 2015 at 10:39
  • @Archemar thank you very much to your reply guys, I already updated my question. :) Commented Apr 15, 2015 at 10:52