Timeline for using `for file in` to select multiple extension names then get the basename of "file" then concatenate an extension name
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 15, 2015 at 11:33 | vote | accept | arvil | ||
| Apr 15, 2015 at 11:06 | history | edited | terdon♦ |
edited tags
|
|
| Apr 15, 2015 at 11:01 | answer | added | terdon♦ | timeline score: 2 | |
| Apr 15, 2015 at 10:53 | comment | added | arvil | @roaima I updated my question | |
| Apr 15, 2015 at 10:52 | comment | added | arvil | @Archemar thank you very much to your reply guys, I already updated my question. :) | |
| Apr 15, 2015 at 10:52 | history | edited | arvil | CC BY-SA 3.0 |
added 760 characters in body
|
| Apr 15, 2015 at 10:39 | comment | added | terdon♦ |
@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.
|
|
| Apr 15, 2015 at 10:34 | comment | added | Chris Davies |
@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.
|
|
| Apr 15, 2015 at 10:30 | comment | added | terdon♦ |
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.
|
|
| Apr 15, 2015 at 10:23 | comment | added | Archemar | 1 - try *.{jpg,jpeg,txt,dummy} -- 2 - in your sample, you'll generate test1.done from test.jpg and test1.done from test1.jpeg. | |
| Apr 15, 2015 at 10:08 | history | asked | arvil | CC BY-SA 3.0 |