Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
How to substitute a variable containing a directory path into Apache httpd.conf file????
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="MegaC, post: 4762807"] Hi all, I am trying to create a installation script for our product at work. The script involves prompting the user for the pathname of Apache (and other components not mentioned here). I then plan to take this user-entered pathname and edit the http.conf file, by globally replacing all occurances of a place holder called "APACHE_HOME" with a ms-dos variable containing the install path entitled %APACHE_HOME%. So, in my ms-dos script, I have something like this: ..... set APACHE_HOME=%userManualPathofApache% .... set PERL_EXE=%IPLANET_HOME/bin/shared/library/perl @rem Above line is the path to the perl version used by iPlanet .... %PERL_EXE% -wpe s/APACHE_HOME/"%APACHE_HOME%"/ < httpd.conf > httpd.conf.mod move /Y httpd.conf.mod httpd.conf What I want to happen is for the ms-dos script to call perl to globally replace all occurances of the placeholder APACHE_HOME with the interpolated variable of %APACHE_HOME% which contains the install path of Apache (eg. C:/Program Files/Apache/Apache2). However, because of the backslashes in the directory name, the substution strips out the /s and leaves C:Program FilesApacheApache2. I tried changing the delimiter from a / to a #, by this command: %PERL_EXE% -wpe s#APACHE_HOME#"%APACHE_HOME%"# < httpd.conf > httpd.conf.mod but I still get the resulting substitution of : C:Program FilesApacheApache2 I know what your thinking, just get the user to enter C://Program Files//Apache//Apache2 ... well I tried that and it STILL gives me the same result of C:Program FilesApacheApache2 in the httpd.conf file. Help!! How do I take the user input of 'C:/Program Files/Apache/Apache2' and use the command of %PERL_EXE% -wpe s#APACHE_HOME#"%APACHE_HOME%"# < httpd.conf > httpd.conf.mod to substitute every occurance of APACHE_HOME with C:/Program Files/Apache/Apache2 as intended? Please help! I am so frustrated by this and it seems like it must be so easy to do!! Please respond to com.rogers@dmegyesi (for SPAM) Thanks, Derek [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
How to substitute a variable containing a directory path into Apache httpd.conf file????
Top