Archive for 'Bash shell scripts'

I have modified the ProjectFiles rc.firewall script so that it can work in recent Linux distributions. Click here to get a copy. This was tested in Slackware64 14.0. To auto-run this in Slackware64 14.0, you can easily just copy the "rc.firewall2" script to "/etc/rc.d/rc.firewall", make the ownership "root:root", and make the permissions 755.

Here are the differences to the original ProjectFiles rc.firewall script:

# diff rc.firewall2 rc.firewall
1190c1190
< if (( `find /lib/modules/$(uname -r)/ -iname "*$1*.ko*" | cut -d/ -f5- | grep -c "$MODULE"` )); then --- > if (( `modprobe -l | grep -c "$MODULE"` )); then

I found this Bash shell script somewhere in the internet, and I find it useful for removing duplicate files. 🙂

#!/bin/bash
OUTF=rem-duplicates.sh;
echo "#!/bin/sh" > $OUTF;
find "$@" -type f -exec md5sum {} \; |
sort --key=1,32 | uniq -w 32 -d --all-repeated=separate |
sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF;
chmod a+x $OUTF; ls -l $OUTF

Back to top