What actual problem are you trying to solve? Why should your
s1
(or any tool) behave differently if run from an interactive shell, non-interactive shell or from whatever? Please make sure there is no XY problem here. [Edit] the question if there is.