Hacker News new | past | comments | ask | show | jobs | submit login

Okay so how would it be done without mv..using the POSIX rename syscall?

https://pubs.opengroup.org/onlinepubs/009695399/functions/re...

mv is basically just a shim over rename so I don't see your point.

Shell may be to glue things together but it's supposed to also be a decent language for doing file/filename related things.






My point is that mv is a compiled C program, not a shell builtin or piece of shell syntax, that you may nonetheless call in a shell script to extend the functionality of the shell. rename is another such compiled C program. To say that it's awkward to batch rename files with mv may be true, but that's a deficiency of an external C program being used beyond its original purpose. Since we're using external programs anyway, you can just use one that's actually designed explicitly for the purpose renaming files.

Mv can be replaced with the rename syscall and the lack of versatility of shell is still demonstrated. Point taken though, pre packaged selection of utilities is arbitrary.



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: