Bluez is packaged with a set very useful scripts. Exemple to connect to a Bluetooth access point:

$ /usr/share/doc/bluez/examples/test-discovery       
[ 00:22:FD:35:3D:74 ]
   Name = Nokia 5310 XpressMusic
   Paired = 0
   LegacyPairing = 1
   Alias = Nokia 5310 XpressMusic
   Address = 00:22:FC:38:3F:79
   RSSI = -63
   Class = 0x5a0204
   Icon = phone
$ /usr/share/doc/bluez/examples/test-device create 00:22:FC:38:3F:79
/org/bluez/1104/hci0/dev_00_22_FC_38_3F_79
$ /usr/share/doc/bluez/examples/test-network 00:22:FC:38:3F:79 NAP &
Connected /org/bluez/1104/hci0/dev_00_22_FC_38_3F_79 to 00:22:FC:38:3F:79
Press CTRL-C to disconnect
$ sudo dhclient bnep0
[...]

(Tested on Kubuntu 10.4beta2)