A professor who was put in jail over social media posts amid the India-Pakistan flare up has been released on bail.