Let $f:\mathbb{R}\to\mathbb{R}$ be a map sending closed intervals to closed intervals. Prove that $f$ is continuous or find a counter example.
WLOG we just have to prove continuity at $0$ and we can also assume that $f(0)=0$ and $f(1)=1$ (by considering $x\mapsto (f(x)-f(0))/(f(1)-f(0))$ ).
I build up this question while thinking of the question Mappings preserving convex polyhedra.
This is false. Consider $$f(x)=\begin{cases} \sin \frac{1}{x} & x\ne 0\\ 0 &x = 0 \end{cases}$$ which is discontinuous at $0$. However, for any closed interval $I$ not containing $0$, we have that $f(I)$ is a closed interval since $f$ is continuous on $I$, and for any closed interval $I$ containing $0$ we have $f(I)=[-1,1]$.