A man appearing in court was shot and killed just after leaving the Cook County courthouse Friday morning.