what does "rm //" delete?

Parv parv at pair.com
Sun Nov 28 10:50:40 PST 2004


in message <20041128112146.GA1696 at 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

-- 



More information about the freebsd-questions mailing list