Date: Fri, 10 Feb 2012 19:44:30 +0200 From: =?utf-8?B?0JrQvtC90YzQutC+0LIg0JXQstCz0LXQvdC40Lk=?= <kes-kes@yandex.ru> To: Da Rock <freebsd-questions@herveybayaustralia.com.au> Cc: freebsd-questions@freebsd.org Subject: Re[2]: 'rm' Can not delete files Message-ID: <902108869.20120210194430@yandex.ru> In-Reply-To: <4F353D1F.3020100@herveybayaustralia.com.au> References: <1237723287.20120207235924@yandex.ru> <4F31A260.20109@infracaninophile.co.uk> <20120207231716.31aa8bc3@gumby.homeunix.com> <20120209032544.GA58560@ozzmosis.com> <CAE7N2kdmbm_5=c8oNknYQE5HOrvVjtfS4XTGYvxTjEQVbGr-7Q@mail.gmail.com> <4F353D1F.3020100@herveybayaustralia.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Здравствуйте, Da. Вы писали 10 февраля 2012 г., 17:51:59: DR> On 02/11/12 01:34, Henry Olyer wrote: >> So what do I change if I want to increase the shell's file limit? DR> I don't think you can. It's not a shell limit. It's a limit to the DR> number of arguments the command itself will take. As said, the shell DR> expands '*' to a list of files as the argument, and rm is limited to the DR> number of arguments it will parse. Mya be it would be better in program do not process options 'all at once'. but instead process them one by one: get next option, remove file, get next option, remove file .... for $i in (@options) do delete_file( $i ) >> I use bash 4. >> >> And by the way, for me, part of the normal installation of a new FBSD box >> is to make certain changes. For example, for "uniq -c" I use "%06" instead >> of "%d" because this way I can sort the output. Things like that. >> >> I never learned a shell language. I suppose no one is as dumb as someone >> who choose's not to learn, so, what's the right one. csh?, because I do a >> lot of scientific work?, or should I be looking at another? DR> There's not really much difference in this factor for shell types; as DR> for changes you'd have to hack the command's (say rm) code. DR> As mentioned, I'd use the find -delete combination. >> On Wed, Feb 8, 2012 at 10:25 PM, andrew clarke<mail@ozzmosis.com> wrote: >> >>> On Tue 2012-02-07 23:17:16 UTC+0000, RW (rwmaillists@googlemail.com) >>> wrote: >>> >>>> On Tue, 07 Feb 2012 22:14:56 +0000 >>>> Matthew Seaman wrote: >>>> >>>>> ls -1 | xargs rm >>>> but be aware that that wont work for filenames with spaces. >>> In addition, I don't believe it solves the OP's initial problem of the >>> argument list being too long! You'd probably need to use the xargs -n >>> switch here. >>> >>> The above will also try to 'rm' directories, which won't work. >>> >>> Instead I would use 'find': >>> >>> find . -type f -depth 1 -delete >>> >>> This will also work with filenames with spaces. >>> >>> Or the scenic route, using xargs, with one rm per file (slower): >>> >>> find . -type f -depth 1 -print0 | xargs -n1 -0 rm -f >>> >>> (The "scenic route" is useful if you want to do something else with >>> the files instead of deleting them with rm.) >>> >>> Regards >>> Andrew -- С уважением, Коньков mailto:kes-kes@yandex.ru
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?902108869.20120210194430>