[CentOS] command line escaping a dash

Bob Beers bob.beers at gmail.com
Mon Oct 20 15:15:14 UTC 2008


On Mon, Oct 20, 2008 at 11:04 AM, Craig White <craigwhite at azapple.com> 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.
>
> ?

maybe ...

# chown -R -- Administrator  '-BILLED JOBS - 1997-2002'

Make sure all options are before the --, which forces end of options, IIANM.

-Bob



More information about the CentOS mailing list