Hi all,

I am writing a quick bash backup script and it can be run
by any user. At the end of the script I want it to 
email the user with a reminder to copy the tar files 
it created to another machine. 

So what I want is a unix command to tell me the current
user of that script ie who invoked it.
An apropos uid showed there were functions like getuid but
they arent suitable for calling up in a sh script.

Basically it's like this....

#!/bin/sh
# Synopsis, author,date into ect stuff..
list_of_users="archive mikel lindax"
for i in $list_of_users; do
        filename=$i.$now
        echo "Backing up /usr/people/$i/Structures/..."
        echo "tar cvf $filename.tar /usr/people/$i/Structures/* 2> $filename.log"
        echo "gzip $filename.tar"
        echo "Backup file saved as $filename.tar.gz"
        echo ""
done

then *something* like this...
exec "mail -s "Reminder to move backups." $user" etc
and include a few lines of text in the mail message.
ie the filenames to move.

Mike
-- 
-------------------------------------------------------
Michael Lake
University of Technology, Sydney
Ph: 9514 1724 Fx: 9514 1628 email: [EMAIL PROTECTED]
-------------------------------------------------------

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to