why not gnu-style command line arguments?

Hi all,

I admit this is a newbie question, and first of all allow me to say I love FreeBSD and I'm comfortable with it as it is. However when I show FreeBSD to my Linux colleagues I often am asked about why the need for such basic userland commands that do not accept the flexible syntax as GNU/Linux commands do. I mean, in several GNU/Linux commands you can specify options almost in every position of the command line, while in similar commands in FreeBSD you cannot. I suspect this is due to the adoption of the gnuopts library, but I'd like to know if there is a rationale behind this choice in order to be able to convince more Linux users!

Thanks
 
There's a simple explanation for that: history. Keep in mind that the utilities that come with FreeBSD pre-date the Linux/GNU ones by about 2 decades.
 
fluca1978 said:
I mean, in several GNU/Linux commands you can specify options almost in every position of the command line, while in similar commands in FreeBSD you cannot.

Could you give an example?
 
wblock said:
Could you give an example?

In Linux this is valid, but not in BSD: $ ls /some/path -d

Coming from Linux it was hard to get used to this. Even now and then when I write chmod killasmurf86:killasmurf86 I need to return to space after chmod to add -R flag that I forgot
 
Those commands expect main argument to reside in argv[argc - 1]. First the options then the main argument. That's called standardization.
 
GNU software tends to be a bit bloated and less optimized than it's BSD and UNIX counterparts. It was actually done for legal reasons to make obvious the gnu software was a clone and not a infringed copy. From their coding guidelines:

http://www.gnu.org/prep/standards/standards.html#Reading-Non_002dFree-Code

Unix utilities were generally optimized to minimize memory use; if you go for speed instead, your program will be very different. You could keep the entire input file in memory and scan it there instead of using stdio.

Explain to your Linux colleagues that writing portable code is more important than using the so-called extensions. Look at the link in my sig.

~
 
Back
Top