From owner-freebsd-questions@FreeBSD.ORG Fri Sep 12 21:23:55 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8FEB106564A for ; Fri, 12 Sep 2008 21:23:55 +0000 (UTC) (envelope-from dave.list@pixelhammer.com) Received: from smtp1.tls.net (smtp1.tls.net [65.124.104.104]) by mx1.freebsd.org (Postfix) with ESMTP id 73FF28FC13 for ; Fri, 12 Sep 2008 21:23:55 +0000 (UTC) (envelope-from dave.list@pixelhammer.com) Received: (qmail 19800 invoked from network); 12 Sep 2008 21:23:54 -0000 Received: by simscan 1.2.3 ppid: 19787, pid: 19795, t: 4.3880s scanners: attach: 1.2.3 spam: 3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on smtp1.tls.net X-Spam-Level: X-Spam-Status: No, score=0.2 required=10.0 tests=ALL_TRUSTED,TVD_RCVD_IP autolearn=disabled version=3.2.1 Received: from 208-70-44-246.bb.hrtc.net (HELO ?192.168.1.46?) (ldg%tls.net@208.70.44.246) by auth-smtp1.tls.net with ESMTPA; 12 Sep 2008 21:23:50 -0000 Message-ID: <48CADDDB.1070308@pixelhammer.com> Date: Fri, 12 Sep 2008 17:23:39 -0400 From: DAve User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <20080904034833.GA25655@k7.mavetju> <48BF71F9.9000004@pixelhammer.com> <1221200256.2581.93.camel@predator-ii.buffyverse> In-Reply-To: <1221200256.2581.93.camel@predator-ii.buffyverse> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: cd and rm a directory with '^M' X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2008 21:23:56 -0000 Wayne Sierke wrote: > On Thu, 2008-09-04 at 01:28 -0400, DAve wrote: >> Edwin Groothuis wrote: >>>> I had rsync create a directory with a '^M' in it. >>> Use command-line completion: >>> >>> [~/xx] edwin@k7>touch foo^Mbar # that's ^V^M >>> [~/xx] edwin@k7>ls -l >>> total 0 >>> -rw-r--r-- 1 edwin edwin 0 Sep 4 13:46 foo?bar >>> [~/xx] edwin@k7>rm foo # autocompletes to foo^Mbar >>> >>> >> If you find yourself on a machine without a full featured shell you can >> delete by the inode number. Chuck Swiger saved my bacon with that trick >> several years ago. >> >> [sysadmin /usr/home/sysadmin]$ touch abc^M >> [sysadmin /usr/home/sysadmin]$ ls -i >> 2449500 abc? 2449511 env.sh >> [sysadmin /usr/home/sysadmin]$ find . -type f -inum 2449500 | xargs rm >> [sysadmin /usr/home/sysadmin]$ ls -i >> 2449511 env.sh >> > However, note that using find's -x option could avoid subsequent > consternation, embarrassment, or worse. -x avoids having find search > over multiple filesystems which in this case avoids having find stumble > upon files with the same inode num on different filesystems. Relevant to > any type of find criteria, but -inum introduces a nice degree of > (user-level) randomness to the mix. Good point to remember. > > Of course, the old adage always applies - "If in doubt - print it > out!" (Not very catchy, is it?) I *always* look at what I am going to remove, *before* I remove it. A lesson learned the hard way once, learned forever the second time. DAve -- Don't tell me I'm driving the cart!