To create a file named "--" you would need the command:

touch -- --

However, do keep in mind that files like this would be really hard to
work with.  For example:

$ ls -la
total 8
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:31 ./
drwxr-xr-x 85 mbt mbt 4096 2009-04-16 00:31 ../
$ touch -- --
$ ls -la
total 8
-rw-r--r--  1 mbt mbt    0 2009-04-16 00:31 --
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:31 ./
drwxr-xr-x 85 mbt mbt 4096 2009-04-16 00:31 ../
$ ls -la *
total 8
-rw-r--r--  1 mbt mbt    0 2009-04-16 00:31 --
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:31 ./
drwxr-xr-x 85 mbt mbt 4096 2009-04-16 00:32 ../
$ rm *
zsh: sure you want to delete all the files in /home/mbt/ex [yn]? y
rm: missing operand
Try `rm --help' for more information.
$ rm -- --

Also, trying to open a file like this?  Using "cat --" won't work; but
"cat -- --" will.

Commands that do _not_ use "--" as an end-of-args symbol will also make
it very hard to work with such files.  This is due to the way UNIX works
generally.

Now, think about what would happen by the way if you have a file named
"-rf".  And let's say you typed "rm *" in that directory, and that
directory contained other directories:

$ touch -- -rf
$ for i in $(seq 1 10); do mkdir $i; done
$ ls -la
total 48
drwxr-xr-x 12 mbt mbt 4096 2009-04-16 00:35 ./
drwxr-xr-x 85 mbt mbt 4096 2009-04-16 00:35 ../
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 1/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 10/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 2/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 3/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 4/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 5/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 6/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 7/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 8/
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 9/
-rw-r--r--  1 mbt mbt    0 2009-04-16 00:35 -rf
$ rm *
zsh: sure you want to delete all the files in /home/mbt/ex [yn]? y
$ ls -la
total 8
drwxr-xr-x  2 mbt mbt 4096 2009-04-16 00:35 ./
drwxr-xr-x 85 mbt mbt 4096 2009-04-16 00:35 ../
-rw-r--r--  1 mbt mbt    0 2009-04-16 00:35 -rf
$ 

Oops.

Long story short: avoid file names that begin with dashes; almost
certainly there is a better naming scheme to use.

** Changed in: gnome-terminal (Ubuntu)
       Status: New => Invalid

-- 
What if exit a file/dir named "-*"
https://bugs.launchpad.net/bugs/362119
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to