Passing values in expect package


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passing values in expect package
# 1  
Old 04-26-2012
Lightbulb Passing values in expect package

i am having specific number of input( as per o/p of another script) say 10
like d1,d2,d3....d10
i want to pass these o/p to expect script.But i don't know how to do that

the the input to the expect script should be like this

Code:
/expect_script.exp $d1 $d2......$dn

as this "dn" depends in user input.i am not getting how to pass it to expect package.
# 2  
Old 04-26-2012
MySQL

You can ask user to enter inputs like this.

echo "Please enter 10 inputs separated by space , followed by [ENTER]:"
read Input

And then just process on Input..
# 3  
Old 04-26-2012
but values are changing on daily basis depending on date
# 4  
Old 04-26-2012
Bug

Every time you run that script it will ask user to enter inputs.. so no need to think on this issue. Smilie
# 5  
Old 04-26-2012
this script is very bulky and have to run on approx 800 routers to get some ftp data.and have to create combine report
hence its so complected for me to write is as i a writing this much big shell first time
i ll provide u the logic hope you can check it out....


if we will schedule this script weekly.....do it will create and change,as dates in every month will be varying.....

Last edited by sagar_1986; 04-26-2012 at 08:35 AM..
# 6  
Old 04-26-2012
Sagar please elaborate on your question and input data. What you want to exact?
And we can schedule this script as you want from crontab. if not possible to use crontab then we can schedule it by using script only. Just clarify on your input and actual script work.
# 7  
Old 04-26-2012
Bug

thanks pamu for helping me .....


lets take an example

there are four groups SAM ROBERT HOLDER each are having four FTP servers under it and 50 files are transferred daily.

hence we have to create a report that how many files are transferred on daily basis for that we have to telnet them and list the files ( listing file format is "ls nc*010412* | wc -l") and grep that output to convert in CSV
and output should be like this
(date will be changing every month and number of columns will be changing depending on date entered)


Code:
date  01-04-12  02-04-12 03-04-12 04--4-12.................31-04-12  total_expected total_available
sam1      50         50        50     50       .................50
sam2      43         50        41     50     ..................50
sam3
sam4

likewise with ROBERT1,2,3,4 and HOLDER 1,2,3,4
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect script not passing password / commands ??

Newbie here. My goal is to have the expect script log into the Ubuntu 18.04 server and run two commands (lsb_release -a and ip addr) and eventually pipe the output/results to a file. For now, I would be happy to get this one command or two to run successfully. How to fix this? #!/usr/bin/expect ... (3 Replies)
Discussion started by: jacob600
3 Replies

2. Shell Programming and Scripting

Trouble passing commands with expect

Hello All, I hope someone could help me with this. I'm creating a shell script to run a process. The trouble is, part of the process has to be ran as a different user. I can 'su' to the user ok, but I'm having trouble passing a 'cd' command as well as some variables I set earlier in the... (1 Reply)
Discussion started by: bbbngowc
1 Replies

3. Shell Programming and Scripting

Passing Password to SSH without using expect in a Script

How can I pass password in SSH command without using expect in a shell program. I don't have expect installed on my Solaris server. #!/bin/bash ssh user@hotname (how to supply pass in script?:wall:) Experts please help its very urgent. Shrawan Kumar Sahu (4 Replies)
Discussion started by: ss135r
4 Replies

4. Shell Programming and Scripting

Passing Values to remote server

I'm trying to pass there values from the present server to the remote server. here is the below code. function abc() { export a=$1 export b=$2 export c="$3" export d="$4" #servers Servers=$(echo server40{1..3}p.s.com) for host in ${Servers}; do #server login ssh $host... (4 Replies)
Discussion started by: Amutha
4 Replies

5. Web Development

Help with passing HTML values in to JavaScript

Not sure if this is the right place to ask this but here goes. I am creating a cheat sheet for co-workers. The concept is that you pick wire size and conduit size and the amount of wires that will fit is displayed. I haven't used alot of drop downs and can't quite figure out the way the get id... (3 Replies)
Discussion started by: zero3ree
3 Replies

6. Solaris

expect package is not invoked from cron

Hi, I am running some etl commands in the windows from shell script(from unix sun solaris 5.9) by using expect package .While running manually the script is working fine.While running from cron it is exiting the after successfully firing the ETL command(The control does not stop after firing... (1 Reply)
Discussion started by: megh
1 Replies

7. Shell Programming and Scripting

passing variable to expect

Please tell me how to pass variable "a b c" to expect from the shell script 1/ example of input file # cat in-file var1 var2 a b c var4 2/ # this is my script - how to pass "a b c" as single variable ? cat in-file | while read x do my-expect x done 3/ # expect script - how to... (0 Replies)
Discussion started by: breaktime123
0 Replies

8. Shell Programming and Scripting

passing values into logrotate??

Wondering if this is possible? OK, here is my question. I'm backing up a TON of different logs in different locations. I'm querying a database for the information. What I'd like to do, is pass that information into a logrotate script for the backup.. i.e. I'm trying to do the following: ... (1 Reply)
Discussion started by: imbiea
1 Replies

9. 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

10. Shell Programming and Scripting

Passing values out awk.

found that passing (input) values to awk, all work well. For example: errpt | awk 'BEGIN { errore=0 } substr($2,1,4) /'ParamData'/ { .... } ' ParamData=`date +"%m%d"` Now I wish to obtain (output) a value. Using this method is it possible to re-write ParamData, for example? Thanks in... (3 Replies)
Discussion started by: gio123bg
3 Replies
Login or Register to Ask a Question