Chittagong: South Africa openers Stiaan van Zyl (33*) and Dean Elgar (28*) safely take their team to 61 for no loss in their second innings at the early stump on day 3, trailing Bangladesh by 17 runs.
Earlier, a maiden half-century from wicketkeeper-batsman Liton Das helped Bangladesh take a useful first-innings lead of 78 runs.
Playing his second test, Das was out for 50 as the hosts were dismissed for 326 shortly before tea after resuming on 179-4 against the top-ranked test side.
Das added 82 for the sixth wicket with all-rounder Shakib Al Hasan (47) after Bangladesh, who had stunned the tourists 2-1 in the preceding ODI series, lost captain Mushfiqur Rahim to Dale Steyn for 28.
South Africa captain Hashim Amla challenged the umpire's original not-out verdict against the leg-before appeal and managed to get it overturned.
Steyn (3-78) also dismissed the last two Bangladesh batsmen to take his test tally to 399 wickets.
Shakib and Das batted resolutely before steering Bangladesh, who have lost all of their previous eight meetings against South Africa, past their opponents' first-innings total of 248.
Das, 20, added 38 runs with Mohammad Shahid (25) for the seventh wicket to boost the lead and was eventually caught by wicketkeeper Quinton de Kock off spinner Simon Harmer.
Like Steyn, Harmer also finished with three wickets.
Brief scores
South Africa - 248 (Bavuma 54, Rahman 4-37, Jubair 3-53) and 61/0 (van Zyl 33*, Elgar 28*)
Bangladesh - 326 (Mahmudullah 67, Tamim 57, Liton Das 50, Steyn 3-78)
Status - South Africa trail by 17 runs