Steve D'Aprano <steve+pyt...@pearwood.info> writes: > On Fri, 6 Oct 2017 09:57 am, Marko Rauhamaa wrote: > > [quoting Bart] >>>> Yes, I tried typing 'sort' in Linux, where it apparently hangs (same >>>> on Windows actually). The reason: because it might have killed >>>> someone to have added a message saying what you are expected to type >>>> and how to end it. (Namely, press Ctrl-D start at the start of a line >>>> in Linux, and Ctrl-Z followed by Enter, I think also at the start, in >>>> Windows.) > > Waiting for input isn't "hangs". That's an ignorant and foolish thing to say, > more suited for a wet-behind-the-ears newbie than somebody who claims to be a > long-time old-school programmer.
I suspect it's a wind-up. <snip> > [Marko] >> As for informational messages, it is part of deep-seated Unix culture to >> have quiet commands. The purpose of the silence is so you can easily >> compose new commands out of existing commands via pipelines and scripts. >> It would be inconvenient if you typed the command: >> >> grep ython message.txt | sort >> >> and the sort command instructed you to press Ctrl-D. > > Indeed it would. > > But in fairness, if the author of the `sort` command had a commitment to > friendliness in their programs, they could have `sort` only print a message > when it is reading from stdin and writing to stdout, I think you mean "when reading from a terminal". In the example given sort /is/ reading from stdin and writing to stdout. > much as `ls` defaults to > outputting control characters but automatically swaps to replacing them > with ? when writing to a terminal. ls often behaves completely differently when writing to a terminal. The main one is that it tabulates the file names into columns! That's very old behaviour. A more modern innovation is coloured output. > I believe that even Unix experts would be more effective with a judicious > amount of not so much hand-holding as gentle guidance. Even experts aren't > expert on every single command line tool. That's true. Some of it is here already. I am addicted to tab completion, especially when it is command-aware. And there's a flip side. I've come across a few too many programs lately clearly written by people who want to be helpful, but the wordy output is hard to parse when using the program in a script. Some programs offer a flag to simplify the output so it can be processed more easily, but not all... > But the OS is what it is, and the culture has a certain level of commandline > machismo, so that's unlikely to change. -- Ben. -- https://mail.python.org/mailman/listinfo/python-list