Andre Majorel wrote:
> On 2010-05-14 11:47 +0200, Ralf Mardorf wrote:
>> File names are allowed to use any sign excepted the /, NUL, * and ? in
>> Linux file names.
> Unix forbids exactly two characters in file names : NUL and "/".
> "*" and "?" are legal ; they just need to be quoted or escaped if
> they appear on a shell command line. Just like white space, ";",
> "(", ")", "|", "<", ">", "&", and a few others.
> The problem is that many shell scripts don't bother quoting
> variable references. Whenever you see stuff like
> cp -p $foo $1
> in a shell script, you have a (latent) bug. That should be written
> cp -p -- "$foo" "$1"
> The "--" is important. It tells cp that the following arguments
> are not to be treated as options, even if they look like one (i.e.
> begin with a "-"). The "--" convention is not specific to cp, by
> the way. It works with any program that parses its command line
> with getopt, i.e. most of them.
ok, I didn't know about the '--' vs '-' argument. If a file name starts
with an '-' the simple trick is to add the path first, IOW, if we are in
the wanted path, we anyway need to add './' first ... regarding to your
spinymouse-sudo@64studio:~/Desktop$ cat ./-n
spinymouse-sudo@64studio:~/Desktop$ cat -- -n
... wow, it works. Do you know that most information about issues
similar to this one don't have good explanations in the web?
And pardon that it might be a little bit OT.
64studio-users mailing list