Many Unix-like/POSIX systems have issues with handling filenames and pathnames in shell scripts, which can lead to bugs and security vulnerabilities. Some shell programming books and even the POSIX standard sometimes teach the incorrect way to handle filenames. So, it’s crucial to understand how to handle filenames correctly to avoid potential harm. This essay provides a quick summary of how to process pathnames correctly in shell, including basic rules and templates that work. The article also discusses common wrong ways to handle filenames and pathnames in Bourne shells to help readers understand why they don’t work and why the alternatives do.
https://dwheeler.com/essays/filenames-in-shell.html