Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: system call how-to

by elsiddik (Scribe)
on May 01, 2007 at 11:56 UTC ( [id://612965]=note: print w/replies, xml ) Need Help??


in reply to system call how-to

now im i managed to use File::Basename. with this code
#!/usr/bin/perl -w use strict; use warnings; use File::Basename; my $path = "/usr/bin/*"; my $files = basename($path); my $dir = dirname($path); print "dir is $dir , files is $files\n"; system "whatis $path";
the output of $files is listening all files in the directory - so far so good , but im still stuck with the same problem - the script is not giving me the real whatis command Output. any idea?

Replies are listed 'Best First'.
Re^2: system call how-to
by cdarke (Prior) on May 01, 2007 at 16:40 UTC
    Check that whatis exists in your Bourne shell. It could be an old version that does not have it (system uses the Bourne shell on UNIX by default). Check the return value, or $?.
    If you want to capture the output in Perl, maybe you should be using qx (or back-ticks) instead?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://612965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-03-29 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found