LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-18-2005, 09:58 AM   #1
alix123
Member
 
Registered: Nov 2004
Posts: 63

Rep: Reputation: 15
Require Linux/Perl equivalent command for windows Command


Hello All

I am looking for a equivalent command in linux for the following perl command.

#code in windows
#test1.pl/test1.exe Code is as follows
system("start c:\scripts\sscript.exe");

#some more code

#end test1.pl

the above perl command in test1.pl will start a new command prompt and start executing the sscriptexe. Morover the test1.pl /test1.exe will go also paralley start excuing the some more code.


The Equivalent of the above code in linux is

#test1.pl in linux
system("perl /root/scripts/script.pl");
#some more code
#test1.pl ends in linux

where as in the linux code as shown above from the shell if go to "/root/scripts" and type the commadn perl test1.pl

it excutes and also start executing it on the same shell.

IS there any similar way from perl to start a script everytime in a new shell. morover the excuting/calling shell should also go on paralley.

I tried
system("xterm -e perl/root/scripts/scirpt.pl") in this case it starts xterms but without executing it exits morover the executing shell looses and cannot go paralley since the current shell started the xterm. it will not get back the control until the started xterm is exited.


i Will be glad if somebody can answer the question.
 
Old 08-18-2005, 10:20 AM   #2
PenguinPwrdBox
Member
 
Registered: Oct 2003
Posts: 568

Rep: Reputation: 31
Are you attempting to use this to spawn a new X-window to run the command?
Or are you simply trying to run the script within it's own process space (forking)?
 
Old 08-18-2005, 12:49 PM   #3
alix123
Member
 
Registered: Nov 2004
Posts: 63

Original Poster
Rep: Reputation: 15
yes Iam attempting to use this to spawn everytime a new X-window to run the command?

yes Iam attempting to use this to spawn everytime a new X-window to run the command? at the same time the calling window should also be able to proceed .

the objective is to :-- get the equivalent of :-system("start c:\scripts\script.exe"). in windows to linux

since we dont have exe's in linux so i want system("perl /root/scripts/scirpt.pl"); to spawn in a new window and should excute. at the same time the current window should be able proccess as well as the spawned window to their own commad excute its own command.
 
Old 08-18-2005, 01:20 PM   #4
PenguinPwrdBox
Member
 
Registered: Oct 2003
Posts: 568

Rep: Reputation: 31
You should not use system, as the calling window will wait on an exit code from the script that you are calling before continuing.

Try using backticks ( ` ) to run the command:

Code:
`xterm /path/to/script`;
See if that will work. You should be able to do what it is you are attempting, without much hassle. If you are unable to get the command to run after the terminal is launched - check the documentation for that terminal to find the syntax of the command. I am not familiar with xterm, so I can't help there....
 
Old 08-18-2005, 01:34 PM   #5
alix123
Member
 
Registered: Nov 2004
Posts: 63

Original Poster
Rep: Reputation: 15
since i want to call/run another script from a perl script

Since I want to call/ run a perl script(which should be excuted on a different shell) from a perl script . so i will have to use system (this is perl command for excuting commands on shell in linux and command prompt on linux)
 
Old 08-18-2005, 03:32 PM   #6
frandalla
Member
 
Registered: Oct 2003
Location: Tokyo - Japan
Distribution: Slackware
Posts: 348
Blog Entries: 1

Rep: Reputation: 37
hey buddy!
try this:

system("xterm -e perl/root/scripts/scirpt.pl &")

this & thing will make the process run on background allowing the rest of the code to go on! =)
 
Old 08-18-2005, 06:13 PM   #7
PenguinPwrdBox
Member
 
Registered: Oct 2003
Posts: 568

Rep: Reputation: 31
It's pretty obvious you don't know perl.

There are multiple ways to call an external command from a perl script:

system()
exec()
and using backticks ( ` )

are among the most popular.

Since you are obviously so much more of an authority, and completely unwilling to accept suggestions from others - I have no doubt that you will figure out how to do it on your own.

For future reference - the people in this forum are trying to help you - so it would serve you well to not be such a know-it-all schmuck.
 
Old 08-19-2005, 02:23 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you just want to start another prog and not wait for it to complete, you do not need a new terminal/window, just something like this:

system("nohup /path/to/script.pl &");

You should have

#!/usr/bin/perl -w

as the first line in the script, so you don't have to specify perl as part of the cmd line.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
equivalent Linux command for windows start cmd alix123 Programming 4 11-16-2008 06:06 PM
Help with System() command on linux PERL I R J Programming 2 01-05-2005 12:20 PM
require help for SED command anirudh Linux - Newbie 2 08-30-2004 02:56 PM
Linux equivalent of Unix command lptops? tdp05 Linux - General 2 09-12-2003 06:45 PM
equivalent command in linux kunto Linux - Networking 2 11-26-2001 02:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration