5 December 2013

Menambahkan teks ke akhir beberapa file di Linux

#!/bin/bash
# Create a tempory file named /tmp/end_of_my_php.txt
cat << EOF > /tmp/end_of_my_php.txt
<html>halo</html>
EOF
find . -type f -name "*.php" | while read the_file
do
    echo "Processing $the_file"
    #cp "$the_file" "${the_file}.bak" 
    cat /tmp/end_of_my_php.txt >> "$the_file"
done
echo
echo done
brut