check this code
Code:
#!/usr/bin/expect
set timeout 5
set Machine [lindex $argv 0]
set Username [lindex $argv 1]
set Password [lindex $argv 2]
spawn telnet $Machine
sleep 1
expect {
-re "(ogin:)|(name:)" { send "admin\r"
&
Hello.
I am trying to debug a script of mine.
I am using the ssh-copy-id from a script run by root.
Code:
#!/bin/sh
# $1 is user_name $2 is computer adress
spawn -noecho ssh-copy-id $1@$2 ]
set timeout 20
send_user "ssh-copy-id started\n"
while {1} {
expect {
^"(Password :)"$ {
 
I am still learning expect, For the below script I always get This is True as the answer. Tried to debug and does not make sense to me. Not sure, where I am doing the mistake. Need Help!
I have write a script which contains
Code:
ssh -p 12345 dcplatform@10.125.42.50
ssh 127.0.0.1 -p 5555 "$CMD"
ssh root@$GUEST_IP "$CMD"
before I use public key, it works well, now I want to change to "expect", BUT I don't want to change above code and "parameter position"
I can post a expect template can some one help me to modify it
Code:
#ca
Code of baul :)
Code:
/*
* Hanx [Proyecto Fedora Peru] wth Code
* crc.c - app
*
* This program is private version, for anti-educational purposes and without any
* explicit or implicit warranty; in no event shall the author or
* contributors be liable for any direct, indirect or incidetal damages
If I execute script
Code:
#!/usr/bin/expect
set pass [lindex $argv 0]
spawn encfs -v {CRIPT_DIR} {MNT_DIR} -o nonempty
expect "*EncFS Password:*"
send "$pass\r"
expect eof
I don't have access to {MNT_DIR}. Sodo user don't have access to.
In the following program though most of the working part of the program is commented out, it gives seg fault. reducing the value of MAX to say 10000 removes the seg fault. Why is this happening? it should be only 1 MB only. Is 1 MB too big for an array?
#include <stdio.h>
#define MAX 1000010
int main()
{
Code:
expect {
-re "(.*)NEXT PAGE(.*)" {
send "\r\n"
}
exp_continue
Quote:
i just want to put for loop in this code i.e.
argv 3 years 11 weeks ago Hi guys
I use the following code to check if a user has specified a certain argument:
if (strcmp(argv[i], "-i") == 0)
{
// do something
}
I use the following code to check whether any arguments have been specified (e.g. -i test1) but it gives me a segemtation fault if no arg for -i is specified: