Link to home
Start Free TrialLog in
Avatar of floydthewall
floydthewall

asked on

getting 'whoami' info into a string

hello,

I want to have a script that will email the user once it is finished. For that I need to have a small function at the end that will check who the user is and then if it is 'floyd' if will send an email to floyd.

the part I am having problems with is identifying the user , for that I though the unix command 'whoami' would be good.

any ideas ,

cheers,
floyd.
Avatar of xDamox
xDamox
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi you can use the following:

#!/usr/bin/perl -w
#
#

$WhoAmI = `whoami`;

if($WhoAmI eq 'floyd')
{
  print"Emailing floyd\n";
}
ASKER CERTIFIED SOLUTION
Avatar of Dave Cross
Dave Cross
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial