By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,866 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,866 IT Pros & Developers. It's quick & easy.

Calling a unix shell script from a perl script

P: 1
I am calling a unix shell script from a perl script by using the following system command:
system("./readfile_new.sh");

but it seems the unix script readfile_new.sh is not being called.
Can someone let me know how to call this script in the perl file/
Oct 26 '06 #1
Share this Question
Share on Google+
4 Replies


miller
Expert 100+
P: 1,089
Is the script in the currently active directory? The above code should work, at least this works for me.

system("./myOtherPerlScript.pl")

http://perldoc.perl.org/functions/system.html
Oct 26 '06 #2

P: 2
I am calling a unix shell script from a perl script by using the following system command:
system("./readfile_new.sh");

but it seems the unix script readfile_new.sh is not being called.
Can someone let me know how to call this script in the perl file/

Hi,
you can call the shell script through a perl script using the following command below....

system("sh","readfile_new.sh");

If your shell file is in current directory,then this should work. (FYI: I use korn shell). If your sh script is in some other dir then specify the path.
Hope this works for you.
Feb 1 '08 #3

P: 2
I am calling a unix shell script from a perl script by using the following system command:
system("./readfile_new.sh");

but it seems the unix script readfile_new.sh is not being called.
Can someone let me know how to call this script in the perl file/
oops.. u had posted in 2006!!! I noticed it after posting my reply !!
Feb 1 '08 #4

P: 33
you can use either system function call or keep the unix command you want to execute between backticks.
Feb 1 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.