Nixers Book Club - Book #1: The UNIX Programming Environment - Community & Forums Related Discussions
Users browsing this thread: 7 Guest(s)
|
|||
You guys already made a lot of interesting points. Here’s a couple of notes from me.
Quote:What happens if no files match the pattern? The shell, rather than complaining (as it did in early version), passes the string on as though it had been quoted. I’d love to know the reason for this decision. If there are metacharacters in a string and it doesn’t match anything, why not expand it to “nothing”? This is what “set -o nullglob” does these days. That way, I can be sure that I’m only dealing with existing files. Quote:The UNIX and the Echo Lovely little story. When the book was written, the shell didn’t have a “printf” builtin yet, it appears. According to Wikipedia and gunkies.org, it was only introduced in 1990. GNU coreutils defines “echo” as “display a line of text” today. That’s still slightly ambiguous (depends on “line” being “something followed by \n”, which some people still don’t agree with). OpenBSD’s manpage explicitly states that a newline follows, so that’s much clearer. Quote:chmod +x $1 I have had many heated debates about this topic. Personally, I strongly dislike that they don’t use the quoted version "$1". They omit quotes throughout the entire chapter. It probably didn’t matter back in the day, but IMHO it’s just wrong: $1 is not what has been passed as first argument -- it’s the split version of it. Is this really what the user wants most of the time? Or is it "$1", so it’s exactly what has been passed to the script? The counter argument is in this case: If you use "$1", an empty string will be passed to chmod -- instead of no argument at all. This breaks some of their examples later. Quote:venam on IRC: Ohhhhh, yeah. I was thinking the same thing. (It didn’t strike me as much when I first read the book a couple of years ago. Hmm.) |
|||