Thanks for replying to this mail.
Now I need to write a regular expression so that I only get username
from the output of this command.
So I have written like this.
my $usr=`who am i`;
$usr=~ m{(.+)\s$};
print "$usr\n";
But still I am not getting only username.
Please guide.
Regards
Irfan.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Pang
Sent: Friday, October 26, 2007 4:54 PM
To: Beginner
Cc: beginners @ perl. org
Subject: Re: error in qx
On 10/26/07, Beginner <[EMAIL PROTECTED]> wrote:
>
> -bash-3.00$ who am i
> dpaikkos pts/14 Oct 26 12:16 (host.mydomain.com)
>
> Work for me on a bash shell as does whoami.
No.
You're actually executing the `who` command,which just take the `am i`
as its arguments.
The results are the same:
$ who am i
pyh pts/0 Oct 26 18:48 (116.21.60.xx)
$ who
pyh pts/0 Oct 26 18:48 (116.21.60.xx)
This is `whoami` 's output:
$ whoami
pyh
--
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/