1. 7
  1.  

  2. 4

    This is a cool idea! It would be nice to have it integrated into my terminak.

    It needs some work, though.

    I’m not sure this really clarifies what <~/devel/netbook-misc-devel/bible-pg10.txt tr -cs a-z0-9A-Z ‘\n’ | sort | uniq -c | sort -nr | head does, or why you would want to put the <-redirection at the beginning. exec vncserver -geometry 1270x900 is totally useless. ffmpeg -f video4linux2 -r 30 -i /dev/video0 -f alsa -i hw:0,0 “$@” basically doesn’t work. amixer -D pulse set Master 1+ unmute also basically doesn’t work. cat $(ls -d /etc/init.d/* | sort -R | head -1) also basically doesn’t work. if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf; fi kind of works.

    But maybe I’m asking too much.

    Usually I find that finding the options in an example command line in a man page is relatively straightforward; what’s harder to understand in many cases is what options you want to achieve what you’re looking for, how things interact with each other, and what kinds of bugs you need to avoid.

    1. 2

      This idea plus a saner shell? Maybe add it to the IPython Notebook?

      1. 1

        Doesn’t the IPython Notebook already have on-demand docstrings and argument lists?

      2. 2

        dest=${file##*tmp-rules--} doesn’t work usefully either.

        1. 3

          I suspect it just parses the shell, doesn’t actually run it.

          1. 2

            **I half-expected this to recursively analyse each call.

          1. 2

            Yeah, it claiming that those are the -b, -a, and -r flags is pretty bad. To be fair you need a special command-line parser for tar commands :)

            1. 1

              Really only the first argument. Historic back compat permits leaving out the dash on the first option block, but after that it’s mandatory.

              1. 1

                Does *BSD use a tar that still requires the z?

                1. 1

                  It pipes out a separate program based on the letter (compress for Z, gzip for z, bzip2 for j). The tar command itself knows nothing about compression.

                  On OpenBSD, compress and gzip are the same program and can decompress the other’s data, so you can use z (or Z) for both tar.Z and tar.gz files, but must use j for tar.bz2.

                  1. 1

                    I guess the explicit CPS style of bsdtar_getopt makes this a little trickier to implement than I naïvely thought, but is this lack of feature because you think that automatically adding the z if the filename ends with .gz is ⓐ actually a bad idea? or ⓑ more code to maintain that nobody’s willing to?

                    1. 2

                      I think there’s a fair bit of reluctance to add these little magic features that only work some of time (but not, for instance, when using a pipe) because then you have to remember when to specify the letter and when not to. That seems harder to remember and more error prone than just always specifying z.

                      1. 1

                        Thank you for the explanation!

          2. 2

            “This allows file names that contain newlines…” ಠ_ಠ

            1. 3

              It’s entirely possible, and yeah, it’s a huge pain in the ass to deal with.

              $ touch file$'\n'name
              $ echo *
              file
              name
              

              In fact, any byte other than null and slash are legal in filenames. It’s a safe bet that a significant majority of software doesn’t correctly handle every possible filename.

            2. 1

              Ubuntu-specific, apparently.

              http://explainshell.com/explain?cmd=nc+-l+1234