Sponsored Content
Top Forums Shell Programming and Scripting How to call expect script from Perl Post 302392485 by cxbest on Thursday 4th of February 2010 01:53:30 PM
Old 02-04-2010
Hi Pludi,

Sorry I didn't make it clear. I mean when I run sub.exp by "expect sub.exp", it can generate the sub.txt, so the expect script should be fine.

But when I run sub.pl with "perl sub.pl", it will generate,

Code:
 
-bash-3.00# perl sub.pl
Content-type:text/html
<html>
<head><title></title></head>
<body>
<textarea name='sub' cols=30 rows=4>
</textarea>
</body>
</html>
-bash-3.00#

If I put the two lines that you indicated above, I will get this,

Code:
 
-bash-3.00# perl sub.pl
Global symbol "@array" requires explicit package name at sub.pl line 20.
Global symbol "@array" requires explicit package name at sub.pl line 22.
Global symbol "$line" requires explicit package name at sub.pl line 26.
Global symbol "@array" requires explicit package name at sub.pl line 26.
Global symbol "$line" requires explicit package name at sub.pl line 28.
Execution of sub.pl aborted due to compilation errors.

My current code is like this,

Code:
 
#!/usr/bin/perl
use strict;
use warnings;
 
system('/opt/xampp/htdocs/hsgw/sub.exp');
 
print "Content-type:text/html\n\n";
print "<html>\n";
print "<head><title></title></head>\n";
print "<body>\n";
print "<textarea name='sub' cols=30 rows=4>\n";
open(INFO, "/opt/xampp/htdocs/hsgw/sub.txt");
@array=<INFO>;
close (INFO);
chomp(@array);
 
foreach $line (@array){
print "$line\n";
}
print "</textarea>\n";
print "</body>\n";
print "</html>\n";

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how can call perl script as command?

Hello say i have written some perl scripts , now i like to call them in my unix shell as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl" will be called from every where as "foo" or "foo arg1 arg2"? Thanks (1 Reply)
Discussion started by: umen
1 Replies

2. Shell Programming and Scripting

how to call a perl script from tcsh?

Hi I am not sure how to call a perl script from a tcsh shell. do i need to set any environment variables? your help is appreciated Thanks (1 Reply)
Discussion started by: megastar
1 Replies

3. UNIX for Advanced & Expert Users

Wget call in a Perl script

I've got to do a wget call in a Perl Script. I am basically doing migration of a shell script which was previously doing it. The code in the sh file was as follows. wget -nv -o /tmp/wget.run.log -t 5 -w 10 http://windows-server/myapp/1try.asp?myparam=no This wget command is executing an... (1 Reply)
Discussion started by: rahulrathod
1 Replies

4. Shell Programming and Scripting

Calling Expect script in Perl...

I call a EXPECT script from my perl script with machine IP and a FIle. The script logins to the machine and exports the value. The values to be exported or stored in a file. I have close to 10 machines and I have created 10 files and pass the corresponding files in command line, Now I could like... (4 Replies)
Discussion started by: ramkriz
4 Replies

5. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

6. Shell Programming and Scripting

how to call a bash script using perl

Hi I m new to perl. I m trying to write a perl script that calls a bash script; does anyone have a script already that they can provide or help me out? Thanks a lot. (2 Replies)
Discussion started by: adnan786
2 Replies

7. Shell Programming and Scripting

on HTML form, Call Expect in Perl problem

Hi I have a successfullly run perl script (by issuing command "perl sub.pl" under shell mode) and this sub.pl will call sub.exp successfully. The sub.exp expect script is basically to login to a server and run some commands and put the output into a sub.txt file, it takes about 5 seconds to... (0 Replies)
Discussion started by: cxbest
0 Replies

8. Shell Programming and Scripting

Call .profile in perl script

Hello Gurus Can anyone please let me know how to call .profle file in perl script When I am calling the .profile file its giving error Shall I create unix script which has .profile command and call perl script internally (2 Replies)
Discussion started by: Pratik4891
2 Replies

9. Shell Programming and Scripting

Call a Perl script within a bash script and store the ouput in a .txt file

I'm attempting to write a bash script that will create a network between virtual machines. It accepts three arguments: an RSpec that describes the network topology, and two list of machines (servers and clients). I have a (working) Perl script that I want to call. This Perl script takes an RSpec... (6 Replies)
Discussion started by: mecaka
6 Replies

10. UNIX for Advanced & Expert Users

Calling expect from shell script which inturn call python

Hi Team, I have to execute a task from my local machine, where i keep my .expect,.sh, .bash and .python scripts .Task are coded in the script and has to be executed at remote machine. for that i used following task ..... SCRIPT 1: cat shell_check.sh read value if then expect... (3 Replies)
Discussion started by: Sivarajan N
3 Replies
SIEVESHELL(1)						User Contributed Perl Documentation					     SIEVESHELL(1)

NAME
sieveshell - remotely manipulate sieve scripts SYNOPSIS
sieveshell [--user=user] [--authname=authname] [--realm=realm] [--password=password] [--exec=script] [--execfile=file] server[:port] sieveshell --help DESCRIPTION
sieveshell allows users to manipulate their scripts on a remote server. It works via MANAGESIEVE, a work in progress. The following commands are recognized: list list scripts on server. put <filename> upload script to server. get <name> [<filename>] get script. if no filename display to stdout delete <name> delete script. activate <name> activate script. deactivate deactivate all scripts. OPTIONS
-u user, --user=user The authorization name to request; by default, derived from the authentication credentials. -a authname, --authname=authname The user to use for authentication (defaults to current user). -r realm, --realm=realm The realm to attempt authentication in. -p password, --password=password The password to use when authenticating to server. Note that this parameter can be seen in the process list. Use with caution! -e script, --exec=script Instead of working interactively, run commands from script, and exit when done. -f file, --execfile=file Instead of working interactively, run commands from file file and exit when done. REFERENCES
[MANAGESIEVE] Martin, T.; "A Protocol for Remotely Managing Sieve Scripts", draft-ietf-managesieve-03.txt, Mirapoint, Inc.; May 2001, work in progress. AUTHOR
Tim Martin <tmartin@mirapoint.com>, and the rest of the Cyrus team <cyrus-bugs@andrew.cmu.edu>. perl v5.14.2 2014-06-03 SIEVESHELL(1)
All times are GMT -4. The time now is 08:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy