* This one time, at band camp, Michael Lake said:
> 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.

$LOGNAME and $USER should contain the users name (distro and flavour
dependant - check before you use)

Don't bother with the exec - not needed and you can add some error
checking if you don't exec it.

> mail -s "Reminder to move backups." $USER

Drop me a mail off list if you need any more help.

Greeno
-- 
Greeno <[EMAIL PROTECTED]>
GnuPG Key :  1024D/B5657C8B 
Key fingerprint = 9ED8 59CC C161 B857 462E  51E6 7DFB 465B B565 7C8B

Imagine working in a secure environment and finding the string 
_NSAKEY in the OS binaries without a good explanation
    -Alan Cox 04/05/2001

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

Reply via email to