Options & Arguments [SOLVED]
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Options & Arguments [SOLVED]
Learning how to use the command line. If all options are arguments, but not all arguments are options, what else can an argument be?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Options & Arguments
You'd have to look at a particular command for what the options and arguments would be.
For example, the
Also
For example, the
ls
command. Type ls --help
and it will give you information.Also
man ls
gives complete details.Re: Options & Arguments
As I understand, Options are the things that have a specific name and are prefixed by a standard symbol like "-" or "--" or "/" (Windows). Example: --color or --all or -f. Short Options are like "-p", Long Options are like "--print" and they can refer to the same thing (it's up to the user to decide which they prefer).
Arguments are a value you specify, like "red" or "/etc/somefile.conf". Arguments can sometimes stand on their own or follow an Option.
I also noticed a third type mentioned in the "dd" man page called Operand. Example: dd if=/some/input of=/some/output where the values following the command are called Operands. I'm not sure how widespread that terminology is.
As an example of Options and Arguments, say you had a command called "myprint" that could be called in several ways:
$ myprint /my/file ## print a file
$ myprint -q /my/file ## print a file, silence screen output
$ myprint --color red -q /my/file ## print a file in the color red, silence screen output
--color is an Option that expects a color argument.
"red" is an Argument
-q is an option (with no Argument)
/my/file is an Argument
As to why "all options are arguments", I suspect that is only in the general sense where a command takes a bunch of parameters that alter its behaviour and someone may call all of that "arguments", though I believe the distinction between options and arguments would be considered more precise.
Arguments are a value you specify, like "red" or "/etc/somefile.conf". Arguments can sometimes stand on their own or follow an Option.
I also noticed a third type mentioned in the "dd" man page called Operand. Example: dd if=/some/input of=/some/output where the values following the command are called Operands. I'm not sure how widespread that terminology is.
As an example of Options and Arguments, say you had a command called "myprint" that could be called in several ways:
$ myprint /my/file ## print a file
$ myprint -q /my/file ## print a file, silence screen output
$ myprint --color red -q /my/file ## print a file in the color red, silence screen output
--color is an Option that expects a color argument.
"red" is an Argument
-q is an option (with no Argument)
/my/file is an Argument
As to why "all options are arguments", I suspect that is only in the general sense where a command takes a bunch of parameters that alter its behaviour and someone may call all of that "arguments", though I believe the distinction between options and arguments would be considered more precise.
Re: Options & Arguments
I did a quick search of "computer science difference between option and argument" and this was at the top of the list:
https://stackoverflow.com/questions/364 ... -parameter
https://stackoverflow.com/questions/364 ... -parameter
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
Re: Options & Arguments
if you really want to know the difference between "options" and "arguments" i can give you my ex-wifes phone number...im betting she would love to give ya an earful of the difference...lol...lol...DAMIEN