3 ms·
I don't see any argument for having arguments there, and that is what the OP asked for. One argument for having command-line arguments is that it can be less t
by Someone 10y ago
I don't see any argument for having arguments there, and that is what the OP asked for.
One argument for having command-line arguments is that it can be less typing, as argument names can be implied. Compare:
>cp foo bar
with
>from=foo to=bar cp
It also seems easier to me to specify multiple arguments from the command line, but that probably could be solved (mostly) by changing sh syntax.
- grymoire1 10y agoThe POSIX shell has nothing to do with the syntax of the command. You can write a shell script that can parses cp from=foo to=bar if you wanted to. The shell expands metacharacters and variables, and sets up STDIN/STDOUT. But = is not a meta-character, so it is pased to the command unchanged. Several UNIX commands use that sort of syntax - like dd(1).
- makecheck 10y agoWith the "env" command it’s possible to set environment using key=value for anything (it just means you have to say "env a=x b=y cmd -arg1 -arg2" instead of expecting "cmd a=x b=y -arg1 -arg2" to be valid).
- tene 10y agoThe main argument, to me, for command-line arguments is that they're not automatically inherited by child processes like environment variables are, so you don't have to rely on every process tidying up its environment before executing anything else. To me, that just seems like a recipe for heisenbugs and spooky-action-at-a-distance.