Que tal um script de shell simples usando sha1sum ?
#!/bin/bash
VALUE=$1
FILE=$2
SUM1=$(sha1sum $FILE)
echo "value=$VALUE" > $FILE
SUM2=$(sha1sum $FILE)
if [[ ! $SUM1 == $SUM2 ]]; then
echo "Different" #put your command here
fi
Ao executar:
nxr ~ touch filetest
nxr ~ bash sumtest.sh 1 filetest
-> Different
nxr ~ bash sumtest.sh 1 filetest
->
nxr ~ bash sumtest.sh 2 filetest
-> Different