On Thu, 2009-08-27 at 07:34 +1200, Daniel Hill wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> So I was reading over the old archive of xkcd's blag, and found this:
> http://blag.xkcd.com/2009/04/27/a-problem/
> (read the comments lots of bash tips)
> 
> just wondering if anyone know's any neat tricks and what not for linux
> I wrote this one the other day: WARNING THIS NEEDS ROOT
> AND ASKS FOR IT (VIA SUDO), IT MAY NOT DESTROY YOUR
> COMPUTER I'M WARNING YOU AND I HEAR BY CLAM NO
> RESPONSIBILITY FOR DAMAGE CAUSED
> 
> it will also erase any file called "speed test.txt" in the current running
> directory
> <code>
> FILE="speed tests.txt"; cp /dev/null "$FILE"; for i in `echo /dev/sd?
> | sed "s:/dev/::g"` ; do LINE="Disk:/dev/$i "; LINE="$LINE "`sudo
> hdparm -t /dev/$i | grep "Timing" | awk ' {... print $11 $12 } ' `;
> LINE="$LINE "`sudo fdisk -l /dev/$i | grep "Disk /dev/$i" | awk '{
> print $3 $4 }' | sed "s/,//g" `; echo $LINE >> "$FILE" ; done
> </code>

This is just weird in a coupla ways...

1. Why use sed to remove the /dev/ of the device name, then manually put
it back every time you use it?

2. Why append output to $FILE line by line when you can just redirect
the output of the for loop in one go?

Steve
> 
> - --
> python -c "print \"\".join([
> \"\x79\x71\x6Du\056vgp\x40ae\142nr\".decode(\"\x72o\164\x5F_13\")[i]
> for i  in [1, 12, 9, 5, 13, 0, 4, 3, 5, 0, 0, 8, 11, 10, 7, 11, 9, 4,
> 9, 13, 6, 4, 9, 2] ] )"
> 
> http://www.facebook.com/YellowOnion
> msnim:[email protected]
> xmpp:[email protected]
> http://last.fm/user/Yellow-Onion/
> https://launchpad.net/~daniel-hill
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkqVjlkACgkQGplaCYOFvyuFigCeJil8PJMYL3g8u33z/LFDF85k
> 4XwAni/fb8LNg5TAtEr7RlgpJiSCEmRv
> =VOiP
> -----END PGP SIGNATURE-----
> 

Reply via email to