News for hackers. Stuff that matters.
Re:# - the Unix truth by philh on Wednesday July 21, 2010 @09:17PM (#1537057)
>If there is such nonblank text then for [most unices] this group consists of precisely one argument, as in the example above where argi consists of the single argument "-a -b".

Interesting. This seems pretty unintuitive, I would expect the "-a", "-b" behaviour. (I recognise that this would be more complicated to implement and make it impossible to pass an argument with spaces.) It seems like it could easily cause problems especially if you use `env` to handle paths. But I don't think I've ever run afoul of this.

Re:# - the Unix truth by kree10 on Thursday July 22, 2010 @07:56AM (#1537886)
I miss the old FreeBSD parameter behavior when I could have shebang lines like:

  #!/usr/local/bin/sudo -u someuser /bin/sh
Re:# - the Unix truth by JoachimSchipper on Thursday July 22, 2010 @08:30AM (#1537933)
It does work this way, though.

Try the following files:

    #!/usr/bin/sed -f
    s/a/b/g
    s/c/d/g

    #!/usr/bin/sed -e 's/a/b/g' -f
    s/c/d/g
Re:# - the Unix truth by philh on Thursday July 22, 2010 @10:24AM (#1538187)
It's not clear to me what point you're trying to make, but the second one gives an error: "-e expression #1, char 2: unknown command: `''", because it's getting a single argument containing a quote.

Removing the quotes gives "-e expression #1, char 10: unknown option to `s'", because "s/a/b/g -f" is not a valid sed command.

And to illustrate my point about env, sed for me is in /bin. But "#!/usr/bin/env sed -f" doesn't work, because it looks for a program named "sed -f".

Re:# - the Unix truth by JoachimSchipper on Thursday July 22, 2010 @08:19PM (#1539985)
I was agreeing with you, and providing a simple testcase to show that you were, indeed, right (because I agreed that the behaviour is somewhat surprising). Sorry if that wasn't clear.