In order to configure the environment for your subsequent ant command, you have to include the “. ./setantenv.sh” inside your second call. Both calls result in independent bash processes that dont share their specific environment.
try this:
su - USER -s /bin/bash -c 'cd /PATH/ && . ./setantenv.sh && ant clean all'
0
solved Linux, BASH launch command with special char [closed]