can I torify an entire script by using torsocks once?

I tried to put inside a script torsocks --shell and . torsocks on but it fails. It is possible to make this work inside a script?

#!/usr/bin/env sh

torsocks --shell
#. torsocks on

curl https://check.torproject.org/api/ip

## a lot more code later that needs to be torified