3

Possible Duplicate:
Can command-line commands be made insensitive to order of filenames and options?

It looks like the OS X built-in command line tools, such as ls, du etc are rather strict with regards to the order of parameters.

To illustrate, a command for showing disk usage, 'du', accepts -h as a 'human readable' formatting directive for sizes. If you run the following under OS X Lion, this parameter is ignored:

du . -h

To get it to work, you need to specify the parameter fist, then the location, like that:

du -h .

Coming from Linux (ubuntu) background this seems strange to me - under Ubuntu you can do it either way. This is also becomes quite annoying at times, especially when you realise that you've forgotten to specify a parameter for long command and have to move the cursor to the beginning of it.

Hence is the question: can I change the 'default' behavior of command line tools to be more forgiving? Also, what's the reason for that restriction? A BSD legacy?

marked as duplicate by Kyle Cronin Jan 19 '12 at 8:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

I believe that handling of the parameter order is compiled into the executable. This would mean you'd have to modify the source code of the program(s) to change this behavior.

Not the answer you're looking for? Browse other questions tagged .