The following code will do it like a miracle:
#!/bin/sh
echo 'Providing SUDO script permissions to jenkins'
if ! grep -q 'jenkins' '/etc/sudoers'
then
echo 'jenkins ALL= NOPASSWD: ALL' >> /etc/sudoers
echo 'Defaults:jenkins !requiretty' >> /etc/sudoers
echo 'Completed Successfully'
else
echo 'Already Exists'
fi
Keep Performing,