473,803 Members | 3,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Execute script2 from script1 and transfer two arguments to script2

5 New Member
Hello everybody

need help:
How do i execute script2 from script1 and transfer two things
$first and $second from script1 to script2
Need to do it in unix enviroment and windows also(cmd).

There is a command :system()
i used it as follows:
Expand|Select|Wrap|Line Numbers
  1. #script1;
  2. system ("/just/an/example/script2 $first  $second  ");
  3.  
Did not see any response to this command,
Please help
Thanks a lot
Nov 4 '08 #1
4 1495
Arepi
62 New Member
Try them:

Expand|Select|Wrap|Line Numbers
  1.  open(PIPE,"|perl -w script2.pl"); 
  2.  print PIPE "$omething";
  3.  close(PIPE);
if so in script2 must wait for data <>;

when use pipeing from shell, the output of script1 is the input of script2.

Expand|Select|Wrap|Line Numbers
  1. perl script1.pl | perl script2.pl 
Nov 4 '08 #2
rzismanx
5 New Member
Hello again


The problem with what you suggested is that script1
does a lot of things and among those things it is printing out
some results.So how exectly can i extract that certain data that is needed for script2 from script1.
furthermore i need to transfer two arguments.
Isn't <> waits for one variable?

Thanks again
Nov 6 '08 #3
nithinpes
410 Recognized Expert Contributor
If I understood your requirement correctly, all you want to do is to execute script2 from script1 and pass arguments to script2 from script1.
If that is so, you have to handle these arguments(@ARGV ) properly in script2. For example,
script1.pl
Expand|Select|Wrap|Line Numbers
  1. #script1
  2. $first = "Hi";
  3. $second= "Hello";
  4. system ("D:\\script2.pl $first $second "); 
  5.  
and
script2.pl
Expand|Select|Wrap|Line Numbers
  1. #script2
  2. my ($one,$two) = @ARGV; 
  3. print "first: $one\n";
  4. print "second: $two\n";
  5.  
would print:
Expand|Select|Wrap|Line Numbers
  1. first: Hi
  2. second: Hello
  3.  
Nov 6 '08 #4
rzismanx
5 New Member
Thanks for the reply.

At the begining it did not worked becuase i forgot somthing:
Expand|Select|Wrap|Line Numbers
  1. (system ("perl /path/sc2.pl $first $second ")== 0) or die "myprogram failed ($?): $!";
  2.  
I forgot the "perl" at the command, that why it could not execute the second script.
Stupid, isn't it

Thanks a lot
Nov 6 '08 #5

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

Similar topics

4
4146
by: smarty | last post by:
crontab work every minute How to execute a tasks if the time is 22:30:45 or 22:31:01 id | time | script ------------------- 4 | 22:31:01 | script0.php 3 | 22:31:00 | script1.php 2 | 22:30:45 | script3.php 1 | 22:30:00 | script2.php
1
8128
by: JT | last post by:
i'm using a model, view, control architecture for a group of .asp pages. i can't decide whether to use Server.Transfer or Server.Execute to pass posted data from my control to my model. are there security implications for using Server.Execute? just wanting some advice on pros/cons to each of these since this is the first time i'm attempting to use these methods. TIA
2
7848
by: Abdul Azeem | last post by:
Hi! Any one has Idea, How to use Server.Transfer and Server.Execute, When I tried to use these methods I got an eror: Server object error 'ASP 0230 : 80004005' Server.Transfer Error /SISWeb/portal_logon.asp, line 40 The call to Server.Transfer failed while loading the page.
6
6010
by: PAPutzback | last post by:
The process and execute methods want a path to the executable otherwise they kick out a file not found. So how can I execute the following. It works fine from a command window. echo password| gpg.exe --yes --output c:\working\inbound\test.txt --passphrase 0 -d c:\working\inbound\anstest.gpg
6
4751
by: Sam | last post by:
My problem is that when I am trying to use Server.Execute("Somehandler.ashx") I am getting HttpException. System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3179617 System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean...
5
2510
by: batham | last post by:
Hi Gurus, How can I execute a script during runtime. Here is my code, so how do I execute the new script during runtime which should be a part of the 'topDiv'. Thanks Help is appreciated. - Shailendra ------- CODE ----------------
4
2313
by: ewolfman | last post by:
Hi, This may sound a little complicated, but here goes: I have 2 webforms (lets call them 'x' and 'y'). * - 'x' is a form which contains a single server side TextBox web control, and an iframe. The iframe's src attribute references the 'y' webform.
2
3926
by: Oscar | last post by:
What's the right coding to open another aspx page within server side vb.net (not within the html) ? In case I only code Server.Execute("page2.aspx") with a VB.net Subroutine, the browser shows a mess of both page 1 and page 2 within the same window.
9
4351
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case). The browser then makes a new request to the server to redirect itself to abcd.asp after which the user gets redirected to abcd.asp. But in case of Server.Execute (or Server.Transfer), when the server
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.