in reply to Re: Running a shell command via Perl
in thread Running a shell command via Perl

Thank you ALL
I have it working now.
I also found something else:
use Shell; my $sh = Shell->new; $tmp = $sh->exec('readlink /root/Desktop/PerlScripting/mylink '); print "$tmp";
(here I run the "readlink" shell command)
What is your opinion on this ?
BTW, although most command work, I can't get the cd command to work (e.g - `cd /root/Desktop/perlTesting/` )
Why ?

Replies are listed 'Best First'.
Re^3: Running a shell command via Perl
by johngg (Canon) on Apr 24, 2006 at 09:10 UTC
    Regarding the `cd /root/.... you need to use the Perl built-in chdir

    Cheers,

    JohnGG

Re^3: Running a shell command via Perl
by mda2 (Hermit) on Apr 26, 2006 at 14:59 UTC
    When you need to make a call for system resources try to see (or search in portuguese) if similar command are available on builtin funtions...

    $ perldoc -f readlink readlink EXPR readlink Returns the value of a symbolic link, if symbolic links are implemented. If not, gives a fatal error. If there is some system error, returns the undefined value and sets $! (errno). If EXPR is omitted, uses $_.

    This resource is new for me, but my first try is perldoc local or via web. (the second is CPAN! ;)

    --
    Marco Antonio
    Rio-PM