Where?You asked
You wrote: “It is a bug in my oppinion.”Where?
An "expert" in the meaning you seem to imply will, when confronted with "unexpected" behavior, do some research, or just ask, instead of prematurely claiming something is a "bug" or "wrong".UPDATE: And I am sure that also experts from time to time do error of beginners. It is posix, it is consequent
behaviour, but in my opinion a risky.
There is, but that's a whole other topic not related here.There is a reason why rm has a flag -i.
-i
option is nice but not for automated scripts. With scripts you really need to handle filenames properly, especially if you store those filenames in variables that are dynamically filled. Most sysadmins take care of naming files properly (they know certain characters are difficult to handle, like the aforementioned -
), but leave it to users to come up with some really funky filenames. Filenames that can royally screw up your scripts if you don't account for them.I just asked, in this informal forum. I think this is what makes the forum a nice distraction, a little small talk,An "expert" in the meaning you seem to imply will, when confronted with "unexpected" behavior, do some research, or just ask,
instead of prematurely claiming something is a "bug" or "wrong".
And there's absolutely nothing "risky" with POSIX specifying that options start with a dash, and a double-dash marks the end of options. If you're doing it wrong, it will just not work.
Let me answer by giving three quotes from my collection of usenet signatures.UPDATE: And I am sure that also experts from time to time do error of beginners. It is posix, it is consequent
behaviour, but in my opinion a risky. There is a reason why rm has a flag -i.
It is very trivial, but of course, you have to understand the concept. For the commandline invocation of a conforming utility, there are a few simple rules:I knew the double dashes on only few programs. I never needed them before. The fact that this double
dash mechanism is necessary, tells that it is not a trivial problem.
Saying “in my opinion” is redundant. Of course it is your opinion, even if you don’t mention it.I did not claim, I said my opinion, that in your opinion does not count. Then why is that so a big offense?!
Actually it is trivial, as soon as you are aware of how the parsing of command line arguments works in UNIX.I knew the double dashes on only few programs. I never needed them before. The fact that this double
dash mechanism is necessary, tells that it is not a trivial problem.
./-file
) or the absolute file name (/dir/-file
or $PWD/-file
). Of course, this won’t work if the argument is not an actual file, for example when doing things like expr -- -100 + 300
or grep -- -strike- somefile
– in these cases you have to use double dashes, indeed.It is. You can't have a text interface without some meta-chars at least.I knew the double dashes on only few programs. I never needed them before. The fact that this double
dash mechanism is necessary, tells that it is not a trivial problem.
It is very trivial, but of course, you have to understand the concept. For the commandline invocation of a conforming utility, there are a few simple rules:
Saying “in my opinion” is redundant. Of course it is your opinion, even if you don’t mention it.
But still, it is a wrong opinion because it is based on ignorance.
It is. You can't have a text interface without some meta-chars at least.
For comparison, writing sed (grep, etc) snippets for FreeBSD ports requires people to juggle 3 levels of escaping. That's make, shell and sed rules. You never know whether you need $, $$ or $$$.Yes, it is trivial that it needs an extra mechanism. Does this mean that the original problem is trivial?
No, all standard UNIX utilities follow those rules. They use getopt(3) or similar library functions for parsing of command line options, or getopt(1) for shell scripts, or the shell’s built-in function for that purpose.Well, perhaps basic programs follow that rules. I know a lot of programs that do not.
Yes, in this case it is trivial. If you think about it, if there are characters with special meaning (like “Yes, it is trivial that it needs an extra mechanism. Does this mean that the original problem is trivial?
-
”), then there must be a way to remove that special meaning. Like <
in HTML when you want to display the character “<
” which has a special meaning.For comparison, writing sed (grep, etc) snippets for FreeBSD ports requires people to juggle 3 levels of escaping. That's make, shell and sed rules. You never know whether you need $, $$ or $$$.
That is, using your vocabulary, an opinion based on ignorance and hence wrong: that something is neededthen there must be a way to remove that special meaning.
Don't get me started on the backslash hell you can find yourself in with certain utilities. Dealing with Windows shares for example,For comparison, writing sed (grep, etc) snippets for FreeBSD ports requires people to juggle 3 levels of escaping. That's make, shell and sed rules. You never know whether you need $, $$ or $$$.
\\servermame\share
-> \\\\servername\\share
. And sometimes you need to 'escape' the escape so you end up with \\\\\\servername\\\share
. Or how about the infamous 'wave' escape; s/\/usr\/local\//\//
. It'll drive you completely bonkers if you don't pay enough attention.Since UNIX supports file names that start with a dash, obviously a way exists to handle them.That is, using your vocabulary, an opinion based on ignorance and hence wrong: that something is needed
does not mean that it must exist.
A trivial problem is a problem that can not be reduced (simplified) further. You can look up the meaning in a dictionary if you want.and the real meaning of trivial is: "there are many ways".
Since UNIX supports file names that start with a dash, obviously a way exists to handle them.
Do not need a dictionary. Tri=three, via=way. It hints that there are many ways.A trivial problem is the one that could not be reduced (simplified) further. You can look up the meaning in a dictionary if you want.
# the numbers on left are the inode numbers
$ ls -lai
total 10
2011 -rw-r--r-- 1 martin martin 0 Mar 26 12:59 --what is?this
2001 drwxr-xr-x 2 martin martin 3 Mar 26 12:59 .
2 drwx------ 16 martin martin 41 Mar 26 12:59 ..
$
# find the inode number in question
$ find . -xdev -type f -inum 2011
./ --what is�this
$
# see what really is in the name of the file
$ find . -xdev -type f -inum 2011 -print0 | hd
00000000 2e 2f 20 2d 2d 77 68 61 74 20 69 73 88 74 68 69 |./ --what is.thi|
00000010 73 20 00 |s .|
00000013
$
# remove
$ find . -xdev -type f -inum 2011 -exec rm {} \;
One has to wonder how many other words you have arbitrarily redefined.Do not need a dictionary. Tri=three, via=way. It hints that there are many ways.
One has to wonder has many other words you have arbitrarily redefined.
allgemein zugänglich = generally accessible.triviālis, e (trivium), I) dreifältig, dreifach, germanitas, Arnob. 3, 34. – II) allgemein zugänglich, allbekannt, gewöhnlich, gemein, scientia, Quint.: ludii ex circo, Suet.: verba, Suet.: carmen, Iuven.: mos, Calp.
I know It was just an example of how weird things can get.Most implementations (e.g. sed(1)) will allow any delimiter for e.g. replace commands. So, just writes:/usr/local/:/: