In short my jenkins on a slave machine can execute a program like for example ionic from the execute shell segment, although when I start it by executing a shell script .sh file then it says the command doesn't exist. Is that permissions related? How to set that up? Do I need to exclude that application using visudo?
You need to set the permission of the .sh file to be executable, which can be done with
chmod +x filename
. You need root privilege if you are not the owner of the file. See https://wiki.archlinux.org/index.php/File_permissions_and_attributes to understand permissions.