You don't need to add a "*" to those command as an argument.
"/etc/init.d/tomcat5 *" is the same as "/etc/init.d/tomcat5". This
allows all command line arguments to be passed. Meaning you do not have to have a
wildcard to allow all command line arguments to be processed, because the base command
will allow them to already be processed. With that said you can have /etc/init.d/tomcat5
as a sudo command and the user can issue the command "sudo /etc/init.d/tomcat5
start" , just like the can issue the command "sudo /etc/init.d/tomcat5
restart"
The only time you should add a wildcard to a sudo command is when it's absolutely
necessary. As an example:
/bin/cp /tmp/* /opt/app/files/.
You probably should look at your sudo commands, and reevaluate the necessity of a
wildcard. Also beware the use of wildcards can be very dangerous. You can look at man(5)
sudo for more info on the use of wildcards.
Now as for your command the loop not properly processing the commands with spaces
correctly, I would surmise that you should have quoted your variable in the loop -
while read -r line; do ipa sudocmd-add "$line"; done < /tmp/list.
I usually always echo back the variable before I put the command in, to make sure my
variable is being processed the way I believe it should be. That way if other type of
quoting or adjustment to the variable needs to happen, then it can be. As an example:
while read -r line; do echo "Line - $line"; done < /tmp/list.
Aaron