It's less a BASH task than it is a sed or, perhaps, Perl one.

This one's easy first go-'round:


-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-
targetList=(
    # List files, either explicitly
        one.php
        two.php
        foo.php
        bar.php

    # ... or by using command substitution based on "find":
        $( find baseDir name='*.php' )

    # ... or "ls":
        $( ls $baseDir/*.php )
)

for target in "[EMAIL PROTECTED]"; do

    sed \
        --in-place=.bak \
        -e "1s;../../wp-blog-header.php;'&';" \
        "$target"

done
-==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-


After copying this into a .sh file and running with php files in the same 
directory, i get 
find: baseDir: No such file or directory
find: name=*.php: No such file or directory
ls: /*.php: No such file or directory
sed: can't read one.php: No such file or directory
sed: can't read two.php: No such file or directory
sed: can't read foo.php: No such file or directory
sed: can't read bar.php: No such file or directory

So it appears none of the "find" functions seem to work. Fine that the first 
one, one.php and so does not work as i have 2000+ files and do not want to hard 
type the filenames in. But i don't understand why the 2 other "find" functions 
don't find the php files?
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to