0

Isn't *.{jpg,png} supposed to select every file of any of those types?

I know mv can accept targets in succession like this mv *.png *.jpg folder/, but why {} doesn't work this way?

  • 1
    echo *.{jpg,png} would have easily shown you what the problem is. – Hauke Laging Aug 22 '17 at 21:08
  • 2
    You are misunderstanding the problem. It's not that {} isn't working, it's that mv is returning an error when it can't find anything to match *.jpeg or *.png. The way you have constructed your command, there must be at least one file to satisfy both conditions for the command to complete without an error. – 0xSheepdog Aug 22 '17 at 21:10
2

You are probably looking for

shopt -s nullglob
| improve this answer | |

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.