Date: Wed, 17 Jun 2009 09:06:55 +1930 From: Moises Castellanos <m2o7i1@gmail.com> To: Carmel NY <carmel_ny@hotmail.com> Cc: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: Problem with bash script Message-ID: <2620c3260906160636j1f6758fcgafaa6c50811a3452@mail.gmail.com> In-Reply-To: <BLU0-SMTP586D9F12148D0B6683B635933F0@phx.gbl> References: <BLU0-SMTP586D9F12148D0B6683B635933F0@phx.gbl>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Carmel On Wed, Jun 17, 2009 at 8:39 AM, Carmel NY <carmel_ny@hotmail.com> wrote: > I am attempting to write a simple Bash script that will find all the > '*.pem' files in a directory structure and move them to another > directory. It seems to work until I get to the copy part where it fails. > > My scripting skills are not that good. Perhaps someone could tell me > what I am doing wrong. > > This is the script: > > #! /usr/bin/env bash > > # Save the field separator > oIFS=$IFS > > # Set it to line breaks > IFS=$'\n' > > for i in $(find ./ -name "*.pem" -print); do > > # Get the basename > BN=$(basename $i) > > # copy the file to another directory using the base name > cp $i /usr/home/tmp/$BN > > done > > # Reset the IFS variable > IFS=$oIFS > > exit > > > -- > Carmel > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" > Why you don't use exec flag of find ? You could use: $ find ./ -name "*.pem" -exec cp {} /usr/home/tmp/something \; Regards Moises Castellanos
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2620c3260906160636j1f6758fcgafaa6c50811a3452>