How to control Bluetooth wireless radio from the command line?
Blueutil is a neat little command line tool to do this. It's free and comes with the source code.  If you have homebrew installed, you can install it via brew install blueutil.


  Usage:
  
  Print bluetooth status
  blueutil
  
  Switch bluetooth on
  blueutil --power 1 or blueutil -p 1
  
  Switch bluetooth off
  blueutil --power 0 or blueutil -p 0


Works just fine on a Macbook Pro running Lion (10.7.3) and Mac mini running Snow Leopard (10.6.8). You will get some errors if you switch off the bluetooth whilst a magic mouse is connected, it still works though :)