Red Hat General - Bash question

This is Interesting: Free IT Magazines  
Home > Archive > Red Hat General > January 2004 > Bash question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Bash question
Boris Glawe

2004-01-23, 7:11 pm

Hi,

I've got a file which has a name like this:

-Zero

when I say
mv -Zero Zero

mv complains that the option -Z is not known.

The same happens with
mv '-Zero' Zero
mv "-Zero" Zero
mv \-Zero Zero

is this a bug or is there a way to rename this file ?

greets and thanks Boris
Alexander Dalloz

2004-01-23, 7:11 pm

On Sun, 14 Dec 2003 15:54:11 +0100 Boris Glawe wrote:
quote:

> Hi,
>
> I've got a file which has a name like this:
>
> -Zero
>
> when I say
> mv -Zero Zero
>
> mv complains that the option -Z is not known.
>
> The same happens with
> mv '-Zero' Zero
> mv "-Zero" Zero
> mv \-Zero Zero
>
> is this a bug or is there a way to rename this file ?
>
> greets and thanks Boris



mv -- -Zero Zero

Alexander


--
Alexander Dalloz | Enger, Germany
PGP key valid: made 13.07.1999
PGP fingerprint: 2307 88FD 2D41 038E 7416 14CD E197 6E88 ED69 5653

Boris Glawe

2004-01-23, 7:11 pm

Alexander Dalloz wrote:
quote:

> On Sun, 14 Dec 2003 15:54:11 +0100 Boris Glawe wrote:
>
>
>
>
> mv -- -Zero Zero
>
> Alexander
>
>


thanks :-)
Web Surfer

2004-01-23, 7:11 pm

[This followup was posted to redhat.general]

In article <brhtil$djf$1@newsreader2.netcologne.de>, boris@boris-
glawe.de says...
quote:

> Hi,
>
> I've got a file which has a name like this:
>
> -Zero
>
> when I say
> mv -Zero Zero
>
> mv complains that the option -Z is not known.
>
> The same happens with
> mv '-Zero' Zero
> mv "-Zero" Zero
> mv \-Zero Zero
>
> is this a bug or is there a way to rename this file ?
>
> greets and thanks Boris
>



mv ./-Zero Zero
Alexander Dalloz

2004-01-23, 7:11 pm

On Mon, 15 Dec 2003 08:15:56 -0600 Web Surfer wrote:
quote:

> mv ./-Zero Zero



../ is no valid escaping! It says "current directory".

Alexander


--
Alexander Dalloz | Enger, Germany
PGP key valid: made 13.07.1999
PGP fingerprint: 2307 88FD 2D41 038E 7416 14CD E197 6E88 ED69 5653

Charles LaCour

2004-01-23, 7:11 pm

Alexander Dalloz wrote:
quote:

> On Mon, 15 Dec 2003 08:15:56 -0600 Web Surfer wrote:
>
>
>
>
> ./ is no valid escaping! It says "current directory".
>
> Alexander
>
>


You are correct it is not 'escaping' the - but it works! It is all in
how the command line is parsed. Just like the use of -- on a command
line changes the way any further -'s are handled the ./ preceding the -
causes bash to not treat it as an option indicator.

--
Thanks
Charles LaCour
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com