| ▲ | amelius 4 hours ago | ||||||||||||||||
Yes. There are many reasons why one shouldn't use sh/bash for scripting. But my main reason is that most scripts break when you call them with filenames that contain spaces. And they break spectacularly. | |||||||||||||||||
| ▲ | nixon_why69 2 hours ago | parent | next [-] | ||||||||||||||||
Counter reason in favor is that you can always count on it being there and working the same way. Perl is too out of fashion and python has too many versioning/library complexities. You have to write the crappy sh script once but then you get simple, easy usage every time. (If you're revising the script frequently enough that sh/bash are the bottleneck, then what you have is a dev project and not a script, use a programming language). | |||||||||||||||||
| ▲ | ndsipa_pomu 4 hours ago | parent | prev [-] | ||||||||||||||||
You're not wrong, but there's fairly easy ways to deal with filenames containing spaces - usually just enclosing any variable use within double quotes will be sufficient. It's tricker to deal with filenames that contain things such as line breaks as that usually involves using null terminated filenames (null being the only character that is not allowed in filenames). e.g find . -type f -print0 | |||||||||||||||||
| |||||||||||||||||