Is there currently a measurable shortage of pilots?
Here in the US (because this varies around the world) some sources do say there is a pilot shortage. There are many reasons that have been cited for the decrease in pilots here in the states. But the main points seem to be, 


Rising Costs of training 
FAA upping the required hours (250 -1500) for a full ATP ticket 
Lower conversion from military pilots (there was a time when many of the commercial pilots out there were former service pilots)
Lower Salary Prospects: its no mystery that pilots don't make what they once did nor get the perks they once did. 


Another factor that effects this once you are in the industry is the fact that "seniority" does not transfer over from airline to airline. Generally this is not an issue if you work for someone like American or Delta who have plenty of jobs and steady routes. But if you are captain at NotSoWellEstablishedAir and they go belly up you will most likely join one of the others lower in the ranks if not at the bottom. 

Another thing that is worth mentioning is that it may be more advantageous for a pilot to remain a very senior first officer instead of becoming a very junior captain. You may have more power over your route choice, time off, and general schedule as a senior first officer than as a newly minted captain. For some pilots, like those who may be trying to start a family this may be seen as an advantage.  

As for the shortage over seas (outside the US) that stems from different issues. First and foremost many countries have seen great and more importantly fast economic prosperity which has allowed them to get into the aviation game. A game traditionally filled with high costs and heavy regulations. As such many newly wealthy nations have been able to enter the aviation world much faster than their regulations and training programs can keep up with. The FAA is almost 60 years old with aviation regulations dating back to the 30's with the CAA. There are even some american issued pilots licensed signed by the Wrights them selves from the very early days. Other countries simply don't have the history of growing with aviation like the US and similar countries have had. Thus they have all these new planes but no one to fly them and no well established programs and regulations to create the pilots. In turn they are forced to import trained, certified pilots from elsewhere.