[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [perl] Execute command



Arkanoid wrote (22-05-2005 17:04):
Jesper Krogh wrote:

I sslug.programmering, skrev Arkanoid:

Kim Schulz wrote:

On Sun, 22 May 2005 16:21:07 +0200
Arkanoid <sslug@sslug> wrote:



Hej

Findes der en metode til at få perl til at eksekvere en bash-kommando
og smide outputtet ind i en streng? F.eks uname -a?



noget ala $unameStreng = `uname -a`;


Det prøvede jeg også... men det giver mig bare kommandoen i output:

IRC::add_command_handler("fortune","fortune_msg");
sub fortune_msg {
    my $name = IRC::get_info(1);
    $fortune_cmd = '/usr/bin/fortune -s';
    IRC::print ("\cC02Random fortune from $name:\r\n\cC11$fortune_cmd");
}

Outputtet er noget ala:
Random fortune from Arkanoid:
/usr/bin/fortune -s


Du bruger ' og ikke ` .. du skal bruge den der sidder skråt over å, med
shift. Vi kalder den backticks tror jeg nok.
Jesper



Ahh... viele danke... det var der jeg var gået galt i byen :)

Man kan gøre det mere klart ved at skrive


qx{/usr/bin/fortune -s}


-- René Seindal (sslug@sslug) Seindal Consult






 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *