Search results
If you also consider Windows, it gets even worse: While the Windows command line calls traditionally use /f (at least most of the time, single characters) for options, with : as the separator between options and their value (see e.g. here); cross-platform utilities are widespread (such as those you mention) and bring along the more common hyphen syntax for arguments, with all the ...
Initially, Unix programs took single-letter options preceded by a single dash and optionally bundled: ls -laF. ls -l -a -F. The two commands above are equal. When an option takes a value, it overrides bundling: In gpg -aofoo.gpg, -a and -o are options and foo.gpg is the value given to -o. Most of them did, anyway. tar cvzf is a common sight.
Dec 13, 2023 · Besides, there are neat utilities that can help parsing these commands, such as getopt(3) or the non-standard getopt_long(3) to help parse the arguments of a program. It is nice, for we can have multiple short options combined, as other answers say, like tar -xzf myfile.tar.gz .
A generic processing routine, eg. getopt_long(), would need to know whether a single command line argument could contain multiple options, eg. -ltr. Thus a processing routine would need to be able to differentiate between the two. If I read a single dash, -, then the rest of the command line argument can match multiple options.
Aug 17, 2016 · For example the who command lists the users on a system. This command can optionally show which users accept messages from other users to their terminal - the option for this is -w under Linux, while Solaris uses -T. Long options on the other hand, allows the same option to be used on all commands and they actually describe what the options does.
A single quote may not occur between single quotes, even when preceded by a backslash. Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $ , ` , \ , and, when history expansion is enabled, ! .
People also ask
Does a POSIX command use a multi-letter option before a dash?
Why are there two types of shorthand command combining?
Does GNU have a double dash long option?
Which Unix clone has a single dash long option?
What are some examples of Unix programs without a dash?
Why do UNIX commands have different rules?
I can think of many, including: Single-letter options preceded by single dash, groupable when there is no argument, argument can be attached to option letter or in next argument (many, many Unix commands; most POSIX commands). Single-letter options preceded by single dash, grouping not allowed, arguments must be attached (RCS).