LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-29-2007, 05:35 AM   #1
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Rep: Reputation: 30
perl system relative path problem


I have e perl script that executes another script from another folder. the executed script contains compilation commands on gcc. the problem is that the paths that are given to gcc are relative to the second (the executed script) path not to the first script. How can I solve this?

FIRST SCRIPT (perl script)
Code:
		my $status = system("../fsl_serializer_parser/external/generate2.bat");
    		if (($status >>=8) != 0) 
		{
        		die "Failed to generate pp1.txt";
   		}
SECOND SCRIPT (generate2.bat)
Code:
D:\users\b12573\Work\bld_3c_0015\ptfw_repos\collaterals\fsl_serializer_parser\external>type generate2.bat
gcc -I..\..\..\interface -I..\..\..\interface\framework -I..\..\..\interface\modules -I..\..\..\eab_h223\include -I..\..
\..\eab_video_ti\include -I..\..\..\eab_video_it\include -I..\..\..\eab_ecan\include -I..\..\..\fsl_ss7\include -E -P ..
\..\..\interface\sdf_comp_types.h > pp1.txt
Hope I made myself understood.


Please help!
 
Old 11-29-2007, 08:44 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
.bat ?????

why don't you explicitly change directory in the called script, or in the perl script?

Code:
use Cwd 'chdir';
chdir 'path_to_where_you_want_to_be';
system(...);
 
Old 11-29-2007, 12:54 PM   #3
spank
Member
 
Registered: Aug 2003
Location: Romania
Distribution: Ubuntu 6.06
Posts: 278

Original Poster
Rep: Reputation: 30
solved... chdir is the solution!
 
  


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
Need help in displaying the relative path in C zacodi Programming 4 07-06-2007 01:55 PM
Need help in displaying the relative path zacodi Linux - Newbie 2 07-05-2007 04:14 PM
[bash] relative path grezly Programming 1 01-16-2007 02:30 PM
relative to absolute path vishalbutte Programming 4 01-14-2006 03:17 PM
Relative Path? mikeshn Linux - General 3 05-10-2002 04:09 PM

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

All times are GMT -5. The time now is 09:30 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