Hi all, I wrote this script (prog3a) that replaces all of the occurences of a search-string with the replace-string in the file specified on the command line. the sed command should send the output to a temp file , then the temp file is moved to $file.keep. when i run the script I get the following error message:
prog3a: to: not found
cp: . is a directory (not copied).
could not create the backup file
Below is the portion of the script where the problem is. I would appreciate any pointers.Thanks a lot.
for $file
do
if cp "$file" "$file.keep"
then
:
else
echo "could not create the backup file" 1>&2
fi
if [ -r "$file" -a -w "$file" ]; then
sed "s/$search_string/$replace_string/g" $file > temp
mv temp "$file.keep"
fi
done
prog3a: to: not found
cp: . is a directory (not copied).
could not create the backup file
Below is the portion of the script where the problem is. I would appreciate any pointers.Thanks a lot.
for $file
do
if cp "$file" "$file.keep"
then
:
else
echo "could not create the backup file" 1>&2
fi
if [ -r "$file" -a -w "$file" ]; then
sed "s/$search_string/$replace_string/g" $file > temp
mv temp "$file.keep"
fi
done