Дана 24/05/14 11:52AM, Walter Alejandro Iglesias написа: > I learned about the convenience of adding the '-r' option in the "while > read" loop many years ago when I was writing a script to convert roff to > html, the problem aroused with the backslash in roff comments (.\").
That's more or less the point that answer is trying to make: you should use the right tool for the job. Shell command language is not fit to create parsers or interpreters in. Attempts can be made, but some corner will be hit sooner or later. When that happens, it is time to rethink if the problem would be better attacked by a full-fledged program in a general programming language. Parsers, interpreters and compilers are examples of this. > Immediately, some "experts" started to point me "holes" in my > script, when what I posted was just a sketch. In that case disregarding > shell scripting wasn't useful as an argument since they were proposing > fail2ban.sh (a clear example of using shell scripting for something > complicated. ;-)) Antipatterns are bad. I don't mean the ellipsis in `ls -l ...`. I mean things like cat file | grep hello | cat | sed 's/hello/world/g' | cat - > output for file in `echo `ls *` `; do echo $file; done ls -l | awk '{ print $5 }' # different things with different ls'es # under different locales, and on # different systems, with differently # named files which are something a novice will see and adopt, especially when it is not even communicated as a "sketch", and a seasoned user of shell will just be annoyed with. I've also seen system shell scripts from major distributions of GNU/Linux and some mainstream software projects which feature examples of this kind, so not even their developers are immune to it. More than necessary amounts of bugs and security holes are then not a surprise at all.