Options & Arguments [SOLVED]

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post please read how to get help
Post Reply
User avatar
Level 4
Level 4
Posts: 278
Joined: Wed Nov 30, 2016 2:56 am
Location: Oklahoma

Options & Arguments [SOLVED]

Post by chazb » Mon Jan 29, 2018 1:58 pm

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 chazb on Tue Feb 06, 2018 1:33 pm, edited 1 time in total.

User avatar
Level 11
Level 11
Posts: 3510
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: Options & Arguments

Post by JerryF » Mon Jan 29, 2018 2:14 pm

You'd have to look at a particular command for what the options and arguments would be.

For example, the ls command. Type ls --help and it will give you information.

Also man ls gives complete details.
IF your problem has been solved, please edit your original post and add [SOLVED] to the beginning of the Subject Line. It helps other members.

Level 1
Level 1
Posts: 14
Joined: Sun Jan 14, 2018 10:46 pm

Re: Options & Arguments

Post by johnny9308 » Sat Feb 03, 2018 12:49 pm

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.

Hoser Rob
Level 13
Level 13
Posts: 4627
Joined: Sat Dec 15, 2012 8:57 am

Re: Options & Arguments

Post by Hoser Rob » Sun Feb 04, 2018 10:53 am

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

Level 6
Level 6
Posts: 1374
Joined: Tue Feb 21, 2017 8:13 pm
Location: Alamogordo, New Mexico, USA

Re: Options & Arguments

Post by DAMIEN1307 » Sun Feb 04, 2018 5:19 pm

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

Post Reply

Return to “Other topics”