Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Nov 2004 13:53:34 -0500
From:      Parv <parv@pair.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: what does "rm //" delete?
Message-ID:  <20041128185333.GA24199@moo.holy.cow>
In-Reply-To: <20041128112146.GA1696@oliverfuchs.onlinehome.de>
References:  <20041128112146.GA1696@oliverfuchs.onlinehome.de>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <20041128112146.GA1696@oliverfuchs.onlinehome.de>,
wrote Oliver Fuchs thusly...
>
> I had a directory which contained the following:
>
> ls showed me simple this: "?" with 0 bytes
> ls -axl showed me nothing

Try ...

  ls -lia

... and then, note the inode number in left, your left that is, most
column which will be used in ...

  find . -inum <noted inode number> -type d -print0 \
  | xargs -0 rm -riv


> rm -R //
>
> This was a big mistake which I noticed soon enough (some files in
> /bin were deleted) ... what I want to know is what exactly is
>
> rm -R //
>
> deleting. It seems that it is deleting everything?

Yes, using '//' is same as '/' in some shells.  Try this in a sh-like
shell (sh, bash [23], ksh93) ...

  for shell in sh csh tcsh bash ksh93 blah
  do
    shell=$(which $shell)
    [ -z "$shell" ]  && continue
    echo "checking shell $shell"
    $shell -c 'cd //usr///local/////bin && echo $PWD && pwd'
    echo
  done


... here is what i get in some shells (bash is bash 3) ...

  checking shell /bin/bash
  //usr/local/bin
  //usr/local/bin

  checking shell /usr/local/bin/ksh93
  /usr/local/bin
  /usr/local/bin


  - Parv

-- 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041128185333.GA24199>