On Thu, Feb 08, 2001 at 09:57:57AM -0500, Todd Denniston wrote:
> Matthew J Fletcher wrote:
> > - Due to the requirements of our work we need to be operating as root, (this
> > is set in stone, honist),
> 
> [...] the only time you NEED to be root is to "make
> install [...]", assuming you know how to use file
> permissions. 

Technically true.  They may have some broken development process
mandated by some pointy-haired boss, though.  Beyond the scope of
this list...

> 
> > eg,.
> > 
> > #!/bin/bash
> > su matt
> > tkcvs -dir /usr/src/cvssources &
> > exit
> > 
> > but it dont work,.. any ideas ?

No, it wouldn't.  The "su" command starts up a shell that reads
from standard input, which is your terminal, not the script.
When you quit that shell, the script continues (with the "tkcvs"
command) in the old context, ie. as root.

> > 
> Try this:
> 
> #!/bin/bash
> su - matt -c "tkcvs -dir /usr/src/cvssources" 
> exit

Not all variants of "su" take a -c option; depends which flavour
of Unix you're using.  If yours doesn't, try this version, which
supplies the command you want to run as standard input to the
"su" command, and thus to the subshell that it spawns:

        #!/bin/bash
        echo "tkcvs -dir /usr/src/cvssources; exit" | su matt

(You almost certainly don't need the "; exit", since the subshell
should exit on its own when it sees end-of-file.  I added it for
completeness, in case bash has been told to ignore end-of-file.)

--

|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        [EMAIL PROTECTED]
|  |  /
Interviewer: You've been looking at the stars all your life:
Is there anything in astrology?
Arthur C. Clarke: It's utter nonsense.  But I'm a Sagittarius,
so I'm naturally skeptical.

_______________________________________________
Info-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/info-cvs

Reply via email to