The shank is one of the most feared shots in golf but it is only a mis-hit, so understanding what the cause of a shank is will allow you to understand how to cure the problem.
A shank is simply a mis-hit golf shot that flies very low and extremely right of target. It is caused by swinging too flat on your backswing. To help understand what this means, take an alignment pole and place it on the target line. With a second alignment pole, place it out from the target line at an angle similar to the shaft of your golf club at address. Stand three to four feet to the left of this pole (for right handed golfers) and take up your set up position. A flat golf swing would see you swinging the club head away from the golf ball underneath the alignment pole to your right and then see the club head remaining lower than the pole during the backswing. As you make your downswing from under the pole, the club head will approach the ball from inside the target line, rather than along it and with the club face aiming right of the target you will hit a shank.
To correct this, swing the club head away from the ball over the alignment pole and back at the angle of the alignment pole. Swing back down following the pole again and return the club face back to the ball with the face aiming at the target. This will correct your shank and see you hitting much straighter golf shots.
If you are at the range and unable to push poles into the surface you are playing from, use your stand bag or trolley and bag to create a similar angle for you to follow. Just place the bottom of your golf bag on the target line and stand it up so that it creates the angle discussed previously for you to swing your club head over.
Similarly, you could stand with your back against a wall and practice taking the club head away from the ball so that the shaft of the club becomes parallel to the wall, rather than hitting it. As you do this, work on allowing the club head to rise to hand height so that when the club shaft is at hip height, it is parallel to and forward of the wall and also horizontal.
Work on improving your takeaway and then backswing as just discussed and you will see that you have cured your shank and are hitting much straighter, and longer golf shots before too long.