sudo and script

From: M selcukkaraca <selcuk.karaca_at_aski.gov.tr>
Date: Fri, 29 Sep 2000 11:25:06 -0700

Greetings,

I have just installed sudo and got a new error in my life !

I am trying to give rights to my programmers to search ( with find) some
files and grep on them. I have seen sudo and installed. I have written a
script (which is myprog), and wanted to use like this

sudo mypog

but it gives me the following error ;

/usr/local/bin/myprog: function: not found

/usr/local/bin/myprog: syntax error at line 12: `}' unexpected

The place where the error talks , I have just defined a script function ;
-----myprog-----
....
#Gets user input and assings it to a standard variable $FOutput
function GetInput {
echo ${QText}"\c"
read UserInput
FOutput=${UserInput:-$DefInput}
} --->> it gives error here...
.....

I want to ask
1- is it safe to run a shell script with sudo ? ( I know it is dangerous
with setuid, for this reason I donloaded sudo ...)
2- how can I correct the problem, Can't I call a shell function within a
script running with sudo ...

TIA...

selcuk.karaca_at_aski.gov.tr
Unix sys Admin
ASKI - ANKARA
Received on Fri Sep 29 2000 - 08:25:40 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:41 NZDT