On Wed, 12 Dec 2001 15:13:40 -0600  "R. Quenett" wrote:
> I'd like to run an elementary script with joeuser permissions but
> switch to root for a couple of lines and then switch back to joeuser.
> I've found that su runs in a script and prompts for a password (of
> course:).  Could someone please show me the syntax for providing the
> password to su as part of the script?

Here is a script I use...

-------------------------
#!/bin/sh

cd /tmp/untar
cp /archive/linux/$1.tar.gz .
tar -xvzf $1.tar.gz

cd $1
perl Makefile.PL
make
make test

su root -c "make install UNINST=1"
exit
--------------------------


-- 
-----------------------------------------------------------------------
| Alan K. Jackson            | To see a World in a Grain of Sand      |
| [EMAIL PROTECTED]          | And a Heaven in a Wild Flower,         |
| www.ajackson.org           | Hold Infinity in the palm of your hand |
| Houston, Texas             | And Eternity in an hour. - Blake       |
-----------------------------------------------------------------------

_______________________________________________
Linux-users mailing list
Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users

Reply via email to