Hello Andrew, thanks for your answer.
I tried to do this way:
*#!/usr/bin/perl -w
$res = qx/whoami/;
print $res;
print "-----------------\n";
if ($res eq "daniel"){
print "Welcome, ".$res." how are you?.\n";
}else{
print "Your name isn't daniel\n";
}*
when I executed this script I receive this output:
[EMAIL PROTECTED]:~/Desktop$ perl teste.pl
daniel
-----------------
Your name isn't daniel*
What I did wrong? The script output doesn't should be "Welcome, daniel how
are you?"??
PS: Sorry by my English. I'm not a good speaker... I'm learning yet.
--
*Daniel Barbosa do Nascimento Filho*
*SQA - Analista de Qualidade
VirtualRox - Soluções Digitais
http://www.virtualrox.com*
2008/9/29 Andrew Smith <[EMAIL PROTECTED]>
> Hi Daniel
> I think the qx command will do what you want. It's described in perldoc
> perlop
> An example of it in use is
> perl -e '$res=qx/date/;print $res;'
> --
> Andrew
>
> Daniel Nascimento wrote:
>
>> Hello everyone!
>> I'm learning perl and I need some help.
>>
>> I want to write a script that execute commands into a linux terminal
>> and catch the results but I don't know how to do this.
>>
>> Example: I want a script try to create a new user, but it has to
>> verify if the user is created before do it. If the user was already
>> created the script has to print a message for user informing something
>> like this "user already created"
>>
>> Somebody has a tip for me?
>>
>> PS: Sorry by my English. I'm not a good speaker... I'm learning yet.
>>
>> A big hug and thanks for all.
>>
>> Daniel
>>
>>
>>
>>
>
>
> --
> Andrew
>
>
> ******************************************************************************
> Andrew Smith BSc(Hons), MBA
> Founder & Director
> Valley Technology Research Limited
> VTRL
> 14 Inverleith Place
> Edinburgh
> SCOTLAND
> EH3 5PZ
> T: 0131-5527543 or 0131-5529983(home)
> M: 07807321039
> F: 0131-5512702
> E: [EMAIL PROTECTED])
>
>
> ******************************************************************************
>
>