in reply to Re: Not able to use native linux commands in a perl script
in thread Not able to use native linux commands in a perl script

please see the code fagment below #! /usr/bin/perl print "Hi\n"; 'cp -rf /nihad /tmp/'; Here nihad is a file in my root directory and iam tying to copy this file to /tmp.
  • Comment on Re^2: Not able to use native linux commands in a perl script

Replies are listed 'Best First'.
Re^3: Not able to use native linux commands in a perl script
by Illuminatus (Curate) on Dec 14, 2010 at 15:12 UTC
    I guess you failed to read my admonishment to use <code> tags... Let me make sure I have this right:
    #! /usr/bin/perl print "Hi\n"; `cp -rf /nihad /tmp/`;
    You say that 'nihad' is in 'my root directory'. The use of a possessive bothers me. Some people use 'my root dir' and 'my home dir' interchangeably. Also, since most linux installations have a /root directory (the home dir for user root), that is often what people refer to as the 'root directory'. If, indeed, the file 'nihad' is in the '/' directory, the only reason I can see for it not working is permissions. Does the user you are running the script under have read-permission for both the file 'nihad' and the directory '/'? What happens when you type this command from the shell, as the same user (without the 'f' option, so it will give you an error message if it fails)?

    fnord

      I realize that the errors are result of a syntax error. Thanks every one for all your valuable suggestions.