Using sudo command in shell script in Automator app?
Sudo is not (in and of itself) dangerous. Sudo merely removes protective restrictions, putting the burden of running safe code on you, rather than protecting you behind the scenes. Sudo can be dangerous when, for instance:


You make a coding mistake which has unintended consequences: e.g., if you intend to run:


sudo rm -Rf /Users/yourname/something/something/

but instead you type: 
sudo rm -Rf /Users/yourname/ something/something/ 

(with an accidental space after 'yourname') 


the second script (with the erroneous space) will delete all of the data for user 'yourname' without warning.
You run someone else's code which happens to be malicious. Malicious code run without sudo can do some damage, but malicious code run with sudo can compromise your system entirely.


As long as you're careful, sudo is safe enough. Just be aware of the potentials for harm.