Is there any terminal command I can use to switch directly to a space in OS X 10.6 ?
spaces switch 2
If you have assigned keyboard shortcuts for switching between Spaces in System Preferences, you can trigger them using AppleScript:
This will effectively press
These are the key codes for the number keys:
Just assign an alias to that