In bash, I am not sure if my observation is correct. For most commands, option-like arguments, i.e. arguments that begin with --abc
or -a
, can be anywhere in the list of arguments to the command, while other arguments have some fixed position in the list of arguments.
I was wondering if there are some written/unwritten rules about this? Thanks!
Best Answer
In short - it depends on the program. What bash does is it sends the arguments to the program's main function, which from then on decides what to do with them. Some programs don't care about argument order, some take it into account.