LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   Importing script (https://www.linuxquestions.org/questions/general-10/importing-script-859548/)

sindabad 01-30-2011 08:40 AM

Importing script
 
Hii..

the problem iam facing is as follows:
i have a script in UNIX and i want to run it on windows environment by perl..
how can i do it?

thanx in advance.

EricTRA 01-30-2011 08:48 AM

Hello and Welcome to LinuxQuestions,

ActiveState has Perl distributions for Windows, so you could download that, install it and use your Perl script from Unix/Linux. Be aware though that there are distinct differences between Windows and Unix/Linux, most likely you'll need to change paths and such inside the script. The errors when executing will tell you what to do :)

Kind regards,

Eric

Tinkster 01-30-2011 11:14 AM

Moved: This thread is more suitable in <GENERAL> as it's about how to make
Windows usable, and has been moved accordingly to help your thread/question
get the exposure it deserves.

sindabad 01-31-2011 12:10 AM

viewing documents
 
@EricTra...thanx for the ereply.

actually im running active state perl in my windows...
I used Tk to make a page where you can browse the scripts on your system and view it.
Now the problem is the files only with .pl extension can be viewed.Is there way by which files of any
format such as .doc or excel files can be viewed.

Thanx in advance..

EricTRA 01-31-2011 01:22 AM

Hi,

You're welcome and sorry I cannot help you with the question about Tk. Don't have any experience with it but I assume if you programmed it to show .pl files, that can be easily changed to show all files.

Kind regards,

Eric

sindabad 02-01-2011 12:18 AM

shell script
 
Hii..
I solved my earlier problem.
as there is no dearth of problem..there is another problem i am facing is
that how to run a shell script from perl..

Thanx in advance.

EricTRA 02-01-2011 01:21 AM

Hi,

Not sure but you could try:
Code:

perl <yourscriptname>
Kind regards,

Eric

sindabad 02-01-2011 02:09 AM

not working
 
Hii ERIC once again

But perl<yourscriptname> is not working..
I have a shell script namely date_convert.sh
contents are

DAT="11-05-2010" #dd-mm-yyyy
dd=`expr substr "$DAT" 1 2`
mm=`expr substr "$DAT" 4 2`
yyyy=`expr substr "$DAT" 7 4`
echo "$yyyy$mm$dd"

so how to run this script via perl.
i found a way which says to include system("date_convert.sh") in your perl script.

now when i run the perl file the required output of date_convert.sh doesnot show.

please anyone help me in this regard,.
thanx in advance

Tinkster 02-01-2011 10:23 AM

That's just silly ... do that within perl!
Code:

($day, $month, $year ) = split "-" $var;
$date=$year.$month.$day;


sindabad 02-02-2011 02:38 AM

Hii.
 
@ tinkster../
thanx for the reply..
I know its silly........
But thats only sample shell script...my main concern is to run shell script by perl in windows.
hope u get it..please reply if you know the way

thanx in advance.

sindabad 02-02-2011 04:04 AM

windows to unix
 
hii...
from my study i found out that if your script has certain unix functions then it wont run on windows.
so now im tryin to put my perl script in unix.
so do anyone have th eide what changes should i make in my script apart from shebang line.

thanx in advance

sindabad 02-02-2011 07:11 AM

can anyone tell how to pass variable from one perl script to another...

this is not working.
script1.
$send_var = "This is a variable in param_send.pl...\n";
$ARGV[0] = $send_var;
print "Argument: $ARGV[0]";
system("C:/perlscript/commandline.pl");

script2
$receive_var = $ARGV[0];
print "Parameter received: $ARGV[0]";

now when i run script1 from cmd.
output is:
Argument:This is a variable in param_send.pl...\n
Parameter received:


All times are GMT -5. The time now is 12:23 AM.