# Why make use of superflous dashboard (-) to pass alternative flags to tar?

To create a tar apply for a directory site, the tar command with compress, verbose and also file alternatives can be keyed in hence :

$tar -cvf my.tar my_directory/  But it additionally functions to do it in this manner : $ tar cvf my.tar my_directory/


That is, without the dashboard (-) coming before the alternatives. Why would certainly you ever before pass a dashboard (-) to the alternative checklist?

0
2019-12-02 03:13:52
Source Share
Answers: 3

The dashboard is made use of in order to disambiguate in between an alternative parameter names and also values. I presume it is even more of a typical convention.

0
2019-12-03 05:25:02
Source

You can offer tar alternatives in the typical unix fashion tar -c -f foo -v -B file1 file2 file3 where you require the dashboard to set apart in between alternatives and also parameters or the documents names at the end of the command line. Or you can place all the alternatives with each other in the first argument, in which instance the dashboard is optional.

After that there is ps, where you make use of the dashboards if you are making use of the SysV - ish alternatives, and also leave them out if you are making use of BSD - ish alternatives, simply to make points even more complex.

And also allows not also speak about find.

0
2019-12-03 05:24:40
Source

There are numerous various patterns for alternatives that have actually been made use of traditionally in UNIX applications. Numerous old ones, like tar , make use of a positional system :

command alternatives debates

when it comes to instance tar makes use of

tar *something *f "file run on" *"paths of documents to manipulate" *

In a first effort to stay clear of the complication, tar and also a couple of various other programs with the old flags - debates design permitted delimiting the flags with dashboards, yet a lot of us old individuals merely overlooked that.

A few other commands have an extra difficult command line syntax, like dd (1) which makes use of flags, equivalent indicators, pathnames, debates and also a partridge in a pear tree, all with wild desert.

In BSD and also later on variations of unix, this had essentially merged to solitary - personality flags noted with' - ', yet this started to offer a number of troubles :

• the flags can be tough to bear in mind
• occasionally you in fact intended to make use of a name with' -'
• and also specifically with GNU devices, there started to be constraints enforced by the variety of feasible flags. So GNU devices included GNU long alternatives like --output.

After that Sun determined that the added' -' was repetitive and also began making use of lengthy - design flags with solitary' -'s.

Which is just how it happened the mess it is currently.

0
2019-12-03 05:22:41
Source