mercredi 25 mars 2015

Adding 1 string to end of file, Even when ran multiple times to change MD5


I need to change the md5 of my files, Sometimes once, sometimes multiple times. A friend gave me this script to add a string to the end of the file but i think i may be adding it multiple times when i had a look in a hex editor i saw it twice. I'm also not sure if this is actually editing anything else. Just wanted to get it checked out before i started using it.



#!/bin/sh
echo "md5change`date +%s`"
cat $1 | sed --in-place '/md5change/s/.*//' $1
sed -i '/^[ \t]*$/d' $1
echo "md5change`date +%s`" >> $1
echo "done"


Thanks



Aucun commentaire:

Enregistrer un commentaire