![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using Perl to add hyperlink to html files | Raynon | Shell Programming and Scripting | 17 | 11-01-2007 05:03 AM |
| HTML parsing by PERL | avik1983 | Shell Programming and Scripting | 3 | 02-23-2007 09:25 AM |
| perl and html | marcpascual | Shell Programming and Scripting | 8 | 09-21-2005 08:47 PM |
| Perl: Variable input via HTML | douknownam | Shell Programming and Scripting | 5 | 02-13-2005 11:39 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Perl + Korn + HTML
I have a perl script that prints up the html code and executes a few korn scripts to populate the web code. Disclaimer === I can throw together some korn scripts pretty quick. This code changes pretty frequently. I don’t know enough about perl to do everything I need. One day maybe I'll get there but for now -- This does work at least on the web side. Basically I call a korn script in a variable with tics and print the var inside the html code.... See Below: Code:
Perl Code:
$KSH_CHECK_SCRIPT="scripts/scriptname"; #Check script for UISSssh
foreach (<IN>) {
$HOST="$_";
$KSH_CHECK=`$KSH_CHECK_SCRIPT $HOST`;
print "<tr align=left><th width=20%>$HOST</th><th width=20%>yes</th><th width=20%>yes</th><th width=20%>$KSH_CHECK</th><th width=20%>yes</th></tr>";
}
close IN;
Keep in mind this does work and gives me my expected results. Pretty ? Prob not. After churning the ksh script, it simply echos y or n I would like to also echo some output to a file. The script does exactly that and works as designed when I execute either the ksh script by itself or from executing perl script from the command line. My Problem..... However when I call the perl script form the browser it will not output the additional info from the ksh script to the text file.... In the example below, it is line 32 the is not being executed when running the perl script from the browser. Code:
1 #!/bin/ksh
SNIP out a bunch os variables
16 VER=$( sed -n "/$PKG/"'s/.*'"$PKG"'(\([^)]*\)).*/\1/p' $COLLECT ) ## Thanks JP!
17
18 if [[ $VER = $CORRECT_VER ]];then
19 if [[ $STATUS = N ]];then
20 continue
21 else
22 STATUS=Y
23 fi
24 else
25 STATUS=N
26 MESSAGE="$MESSAGE Update Needed for ${PKG}:$VER to $CORRECT_VER"
27 fi
28
29 if [[ $STATUS = Y ]];then
30 echo "$STATUS"
31 else
32 print $MESSAGE >> $OUTPUT
33 echo "$STATUS"
34 fi
Again all the will work if I run the perl script form the command line. Any Ideas? -Chris |
|
||||
|
%%*&^*&^ (*(*&^*&^*&^ ^%$654%^$
Ok I'm shaking my head in shame. Yes permission problems. The since it executed from the web -- It is a different user. Well thanks very much for pointing out the obvious ![]() |
|
||||
|
Perl buffers output by default. Maybe when you execute from browser you never see the buffered output. Set $| = 1; (or $AUTOFLUSH = 1) and you will turn off buffering on the CURRENTLY SELECTED FILE HANDLE which I'm guessing is STDOUT anyway when you get to that print statement in the perl script...
Anyway, no harm trying it... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|