3 ms·
"What's so cool about this is its flexibility." This is something I have never understood. I am a connoisseur of command line progams. I have used hundreds of
by aplorbust 9y ago
"What's so cool about this is its flexibility."
This is something I have never understood.
I am a connoisseur of command line progams. I have used hundreds of them over decades. I write command line programs and scripts every week. It is an obsession. Yet I am embarassed to admit that honestly I have never understood the benefits of flexibility with passing arguments. I never understood the "getopt" movement. I do not use it. All my programs are very simple and straightforward without heaps fo options.
I apologise for being obtuse, but what am I missing?
To anyone who might be offended: I am not criticising flexibility of commandline arguments or its coolness. I just want to understand what are the practical advantages over something more simple and less flexible, like what I prefer. Only if I understand the advantages can I be an advocate for using numerous commandline options and flexibile parsing.
(Theres another post about setenv et al. on the front page right now. For programs that read from environ variables -- which can be a better alternative to using heaps of commandline options IMO -- I just use envdir from daemontools.)
- tannhaeuser 9y agoTo add to your point, it's really simple, clear, and flexible to just use environment variables as program arguments, as in $ FOO=BAR THIS=THAT ./myprog I think the hyphen syntax for arguments once was primarly useful for interactive use; it still is, but GNU-style long arguments and hundreds of options seem increasingly absurd.
- coldtea 9y ago>Yet I am embarassed to admit that honestly I have never understood the benefits of flexibility with passing arguments. It's about not having to remember what goes before what, if you can put them like this or that, etc ON TOP of remembering the arguments themselves. >All my programs are very simple and straightforward without heaps fo options. If your programs are basically ./a.out then perhaps you're not the target audience for getopts?
- kurtisc 9y agoPart of the Unix philosophy is that every program should be a filter, one that can take input from stdin and output to stdout, so that it can be used in conjunction with other programs (which may not have been written yet). If you wanted to add an optional feature to your program/script and didn't know what parts of it could be changed without breaking places where it was used, adding it as a non-default option allows you to do this seamlessly.
- deleted 9y ago[deleted]