Formation and propagation of a shock wave in a gas with temperature gradients