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*

15
  • Thanks for this thorough and helpful explanation! It worked! A lot is going on behind the scenes here which I was unaware of. Commented Oct 13 at 6:07
  • Your command is subject to potential shell injection Commented Oct 13 at 10:59
  • 1
    @GillesQuénot that would be difficult since the perl rename tool doesn't use the shell to rename files. If you're going to make a wild claim, provide some evidence to support it. If you're talking about *.png then a) it's not my command, it's the OP's command (and they copied it from the answer to another question), and b) it's easily solved by using ./*.png or -- *.png or piping a (preferably NUL-separated) list of filenames into rename, or any of the other common methods of dealing with unknown arbitrary filenames and c) it's beside the point for this particular Q. Commented Oct 13 at 13:39
  • Ah, I see you modified your comment since last time I read it. So why not just adding -- or ./ prefix if you know yourself that's like it's written, it's not 100% safe? Commented Oct 13 at 23:34
  • 1
    1. huh? i edited the comment almost immediately, there would barely have been time between my posting it and then editing it for you to read it. I can't see why that matters at all, anyway. 2. because that's not the point of the question, or my answer. The question is about how variables work in rename, not about filename args, which means it's fundamentally about perl variable scope which is much more interesting to me than adding yet another answer about filename args to the hundreds that already exist. 3. because I don't want to. it's my answer, not yours, and I don't follow your orders. Commented Oct 14 at 1:59