I have a webpage that is in HTML and PHP. In PHP I have tried using exec, system, shell_exec and passthru functions to call an Expect Script file (temp.exp). This Expect file spawns a telnet session that uses "expect/send" commands to retrieve information from an environmental unit (not a normal... (0 Replies)
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)
Hi there,
I need some help regarding the execution of shell script from expect as the method I am trying is giving me error. I wrote an shell program which takes two arguments to telnet to a device and saves the output in a file. Following is the script.... (0 Replies)
Hi All,
I have an Expect script which logs into Cisco switch, performs a show interface command. I want to read a file of ip addresses which will be passed to the expect script.
The script to read the file works, the expect script works on it's own but when i call the 'expect' script from the... (12 Replies)
Hi all,
This is the first time i am using expect.
I am trying to call a function with in the shell script. The function will shh to a new server and will pass the password using expect and send. I need help in calling the fuction i am getting follaowing errors...
here the script
... (8 Replies)
Hi,
Am very new to expect scripting..
Can You please suggest me how to call an expect script inside another expect script..
I tried with
spawn /usr/bin/ksh
send "expect main.exp\r"
expect $root_prompt
and
spawn /usr/bin/ksh
send "main.exp\r"
expect $root_prompt
Both... (1 Reply)
Shell Scipt: temp.sh
su - <$username>
expect pass.exp
Expect script: pass.exp
#!/usr/bin/expect -f
# Login
#######################
expect "Password: " send "<$password>\r"
it comes up with Password: but doesnt take password passed throguh file. (2 Replies)
I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues:
set REMOTE "/root/scripts/remote"
...
log_user 1
send_user "Executing remote script as $user...\n"
send_user "Command to execute is: $REMOTE... (1 Reply)
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)
Hi I am trying the following in my bash script which logs into my machine and runs a command. Trying to solve this using expect.
The first expect statement is hit and it enters the address "10.10.0.10" but when the second expect statement is hit it exits
#!/bin/bash
expect -c '
spawn... (2 Replies)
Discussion started by: skorada
2 Replies
LEARN ABOUT DEBIAN
envpath
ENVPATH(1p) User Contributed Perl Documentation ENVPATH(1p)NAME
envpath - Advanced operations on path variables
SYNOPSIS
Run this script with the "-help" option for usage details.
DESCRIPTION
Parses the command line, modifies the specified path variable(s), and execs the remaining arguments. There are two modes, simple and
advanced:
SIMPLE MODE
Simple mode presents an alternative, platform-independent syntax for specifying paths wherein the path separator is "," and environment
variables can be expanded with @NAME@. For example
envpath PATH=@PATH@,/usr/ucb -- printenv PATH
appends "/usr/ucb" to $PATH and execs printenv PATH. The "--" is optional.
You can also specify prepending or appending by using "+=" or "=+" respectively:
# place /usr/ucb at the front
envpath PATH+=/usr/ucb -- printenv PATH
# place /usr/ucb at the back
envpath PATH=+/usr/ucb -- printenv PATH
Simple mode requires only this script; it does not require Env::Path to be installed.
ADVANCED MODE
Advanced mode basically provides command-line access to the features of Env::Path (see), which must be installed. The "-E" flag selects the
path variable to operate on and other flags specify operations on it. E.g.
envpath -E MANPATH -A /tmp -R /usr/share/man -N -U -- man ...
would take MANPATH, append /tmp to it, remove any references to "/usr/share/man", remove any dirs which don't exist ("-N") and remove
redundant entries ("-U") before running man.
The -Whence option allows patterns. Thus
envpath -W "cat*"
would find all programs on PATH which match cat*.
CLEARCASE WINKINS
A big part of the motivation for this script was for use with ClearCase builds; iff you know or care about ClearCase read on. Typically,
during builds (and not just with ClearCase), pathvars such as PATH, CLASSPATH, and LD_LIBRARY_PATH must be strictly controlled. One choice
is to force static values of these into the environment during the build process, another is to simply require/expect users to set their
paths appropriately. Each of these can lead to subtle build or runtime errors, however, and makes it hard for new users to get up to speed
since their personal environment must be just so.
Another common choice is to use only full pathnames within the Makefile, avoiding reliance on search paths at all. This is often the best
way to go but can suppress ClearCase winkins. For example, say you're generating ascii files of some type with a binary executable you
just built:
$(INCDIR)/foo.h: $(BINDIR)/foomaker $(BINDIR)/foomaker ...
The problem with this is that $(BINDIR) likely contains a platform part such as 'solaris' or 'hpux', which makes it impossible to wink in
the foo.h file on other platforms even though it's ascii. This same thing could come up even with a standard pre-built utility that's in
different places on different platforms; "yacc", for instance, is in /usr/bin on Linux and /usr/ccs/bin on Solaris.
You could modify the path on the fly:
$(INCDIR)/foo.h: $(BINDIR)/foomaker PATH=$(BINDIR)$(SEP)$$PATH foomaker ...
but this suffers from the same problem: since $(BINDIR) and $PATH are expanded literally within the build script they'll suppress winkins.
Here's a solution using envpath:
$(INCDIR)/foo.h: $(BINDIR)/foomaker envpath PATH=@BINDIR@,@PATH@ foomaker ...
This hides the evaluation of BINDIR and PATH such that clearmake never sees anything but the literals, thus clearing the field for winkins.
Of course envpath is capable of doing more than this, but it's the original reason it was written.
AUTHOR
David Boyce <dsbperl AT boyski.com>
COPYRIGHT
Copyright (c) 2000-2001 David Boyce. All rights reserved. This Perl program is free software; you may redistribute and/or modify it under
the same terms as Perl itself.
SEE ALSO perl(1), "perldoc Env::Path"
perl v5.10.1 2003-10-10 ENVPATH(1p)