bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #25946] mv/cp/ls/cd cannot cope with leading dash (-) in directory


From: Micah Cowan
Subject: [bug #25946] mv/cp/ls/cd cannot cope with leading dash (-) in directory names without path
Date: Fri, 20 Mar 2009 22:48:52 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.0.7) Gecko/2009030422 Ubuntu/8.10 (intrepid) Firefox/3.0.7

Follow-up Comment #1, bug #25946 (project coreutils):

cd -- "- test -"

should also work fine.

This is not only expected behavior for cd and ls, but for virtually any
command on a Unix-style system. Arguments that begin with a "-" are
interpreted as strings of options (think of "ls -ltc"), so cd (via the getopt
library function) believes you are trying to pass it a string of options that
includes (among other things) the space character. That's why the special "--"
argument exists: it tells getopt to treat any following arguments as true
program arguments, and not as options.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25946>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]