[CentOS] command line escaping a dash

William L. Maltby CentOS4Bill at triad.rr.com
Mon Oct 20 15:22:09 UTC 2008


On Mon, 2008-10-20 at 08:04 -0700, Craig White wrote:
> I cannot figure this out...
> 
> I would like to change the owner of a bunch of folders whose name begins
> with a dash...
> 
> # chown Administrator \-BILLED\ JOBS\ -\ 1997-2002 -R
> chown: invalid option -- B
> Try `chown --help' for more information.
> 
> # chown Administrator "\-BILLED\ JOBS\ -\ 1997-2002" -R
> chown: cannot access `\\-BILLED\\ JOBS\\ -\\ 1997-2002': No such file or
> directory
> 
> # chown Administrator "-BILLED JOBS - 1997-2002" -R
> chown: invalid option -- B
> Try `chown --help' for more information.
> 
> # chown Administrator '-BILLED JOBS - 1997-2002' -R
> chown: invalid option -- B
> Try `chown --help' for more information.

In most cases, putting a single '-' signals the last "flag" and says
anything thereafter is a "normal" argument. Give it a try like this. I'm
not sure though.

chown Administrator - "-BILLED JOBS - 1997-2002" -R

I'm unsure of the "-R". If a "flag, move it ahead of the '-'.

> 
> ?
> 
> Craig
> <snip sig stuff>

HTH
-- 
Bill



More information about the CentOS mailing list