Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2009 09:09:09 -0400
From:      Carmel NY <carmel_ny@hotmail.com>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Problem with bash script
Message-ID:  <BLU0-SMTP586D9F12148D0B6683B635933F0@phx.gbl>

next in thread | raw e-mail | index | archive | help
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



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