Sponsored Content
Top Forums Shell Programming and Scripting Command substitution in send/expect. Please help! Post 302532909 by thulasidharan2k on Wednesday 22nd of June 2011 10:57:43 AM
Old 06-22-2011
Question Command substitution in send/expect. Please help!

Hi, the following code is not working. How can I cat the last modified file in the path /asdf. Please help!
Code:
expect "asdf%" {send "cat `ls -rt /asdf|tail -1` \r"}


Last edited by thulasidharan2k; 06-22-2011 at 12:27 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect Send

Dear All, I wanna write a script in which it expect something and if it gets whats expected then send the command relating to that. for instance Userame: Asad Required Password for Asad: ****** I tried to use the expect key word but its does not work. I am using Solaris 8/9 If... (1 Reply)
Discussion started by: asadlone
1 Replies

2. Shell Programming and Scripting

replacing expect/send

Dear all, I have a code which needs to do : spawn ftp 10.4.12.22 expect "Name (10.4.12.22:mmsadmin):" send "BillingUser\r" expect "Password:" send "BillingUser\r" expect "ftp>" send "bye" but when i run its say spawn, send and expect is not found... how can i enable or install... (1 Reply)
Discussion started by: asadlone
1 Replies

3. Shell Programming and Scripting

Use Send command of Expect package

HI All, I am currently working on one command line application on AIX (Unix Platform).Here i need to use Expect package. By using Expect package at the top of the script,i want to use just Send command of Expect package to send characters like, 1. Press Enter key 2. Press spacebar 3.... (6 Replies)
Discussion started by: neha123
6 Replies

4. Shell Programming and Scripting

Is there a way to ask expect wait for sometime before running the next send command ?

Hi all, After expect catches the string I specify, is there a way to ask expect wait for sometime before running the next send command ? So my script looks like following, expect "some string" #How to ask expect to wait for a while send "next command" The reason I want to do this is... (0 Replies)
Discussion started by: qiulang
0 Replies

5. Shell Programming and Scripting

scriping expect/send

Trying to script an application's interactive add-user function with expect/send. So far no information is sent, but the add-user function is called. Any help appreciated! Many Thanks #!/bin/sh #!/usr/bin/expect -f #PATH to add-user: PATH to expect PATH=/opt/app-1/sbin:/usr/bin ... (2 Replies)
Discussion started by: nolamiami
2 Replies

6. Shell Programming and Scripting

problem in automating "fdisk" command using send and expect

hi i want to automate fdisk command . i spawned a process containing fdisk command from a process and tried to send the options to fdisk promt from that process. but that spawed process is notstarting itself help me out trying for two days :wall: my code: #!/bin/bash echo... (5 Replies)
Discussion started by: jagak89
5 Replies

7. Shell Programming and Scripting

Expect/Send

Hello Team, Am trying to write a script for installing PAM in mulitiple server by using expect and send command. Am facing the below issues,could you please assist. thanks. # cat /tmp/gkscrpt.exp #!/usr/bin/expect -d spawn /tmp/agent/install_pam.sh expect -re "(y/n) " send --... (1 Reply)
Discussion started by: gowthamakanthan
1 Replies

8. Shell Programming and Scripting

How to use expect and send command in UNIX/Linux?

Hello Everyone, I am executing a unix script which logs into 50+ servers (netapp servers) and runs some commands and captures output locally. Below is the code snippet. file1.txt has names of all the remote servers where I am logging in. #!/bin/ksh #!/usr/bin/expect touch... (1 Reply)
Discussion started by: rahul2662
1 Replies

9. Shell Programming and Scripting

Expect command to send the user input enter or ctrl+c

Hey All, I am writing one script using expect, that script which is used in spawn will accepts only 1. Enter 2. Ctrl+c Press Control-C to exit, Enter to proceed. Could some one share some thoughts to send the above user inputs in linux expect block ? Thanks, Sam (0 Replies)
Discussion started by: SCHITIMA
0 Replies

10. UNIX for Beginners Questions & Answers

To send ID and Password for each command using expect feature in bash script

Dear Tech Guys, I am trying to send some commands on the local server and it always asks for user name and password after each command. To serve the purpose I am using expect function as follows: #!/usr/bin/expect set timeout 20 spawn "./data1.sh" expect "Please Enter UserName: "... (6 Replies)
Discussion started by: Xtreme
6 Replies
Tcl_SubstObj(3) 					      Tcl Library Procedures						   Tcl_SubstObj(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_SubstObj - perform substitutions on Tcl objects SYNOPSIS
#include <tcl.h> Tcl_Obj * Tcl_SubstObj(interp, objPtr, flags) ARGUMENTS
Tcl_Interp *interp (in) Interpreter in which to execute Tcl scripts and lookup variables. If an error occurs, the interpreter's result is modified to hold an error message. Tcl_Obj *objPtr (in) A Tcl object containing the string to perform substitutions on. int flags (in) ORed combination of flag bits that specify which substitutions to perform. The flags TCL_SUBST_COM- MANDS, TCL_SUBST_VARIABLES and TCL_SUBST_BACKSLASHES are currently supported, and TCL_SUBST_ALL is pro- vided as a convenience for the common case where all substitutions are desired. _________________________________________________________________ DESCRIPTION
The Tcl_SubstObj function is used to perform substitutions on strings in the fashion of the subst command. It gets the value of the string contained in objPtr and scans it, copying characters and performing the chosen substitutions as it goes to an output object which is returned as the result of the function. In the event of an error occurring during the execution of a command or variable substitution, the function returns NULL and an error message is left in interp's result. Three kinds of substitutions are supported. When the TCL_SUBST_BACKSLASHES bit is set in flags, sequences that look like backslash substi- tutions for Tcl commands are replaced by their corresponding character. When the TCL_SUBST_VARIABLES bit is set in flags, sequences that look like variable substitutions for Tcl commands are replaced by the con- tents of the named variable. When the TCL_SUBST_COMMANDS bit is set in flags, sequences that look like command substitutions for Tcl commands are replaced by the result of evaluating that script. Where an uncaught "continue exception" occurs during the evaluation of a command substitution, an empty string is substituted for the command. Where an uncaught "break exception" occurs during the evaluation of a command substitution, the result of the whole substitution on objPtr will be truncated at the point immediately before the start of the command substitution, and no characters will be added to the result or substitutions performed after that point. SEE ALSO
subst(n) KEYWORDS
backslash substitution, command substitution, variable substitution Tcl 8.4 Tcl_SubstObj(3)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy