check every file in a directory if it’s not actuallly a jpg, if so rename it to the same name.jpg
| for fil in $(file * | grep JPEG | awk ‘{print $1}’ | sed s/://); do mv $fil $fil.jpg; done; |
simple wget loop – nice for leeching stuff..
| for ((i=1;i<100;i++)); do wget www.archive.net/$i -r -l2; done; |
ping a server to find out if the internetconnection is still around
(takes an ip as argument,should be placed a file I suppose)
#!/bin/bash
ping -c 2 $1 1>/dev/null
if [ "$?" = 1 ]
then
echo “`date` : Network down” >>/home/kitty/ping-log
else
echo “`date` : Network is still up” >>/home/kitty/ping-log
fi |
batch rename of files – this example replaces spaces with “-”. Can be used to replace other stuff in filenames
| for filnamn in *; do mv “$filnamn” “`echo $filnamn|sed -e ‘s/\ /-/’`”; done |
July 12th 2008 Filed into
scripts This post was written by kittyhacker