Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Exclamation Error throwing during bash scripting

    The program is given below
    #!/usr/bin/expect -f
    set force_conservative 0 ;# set to 1 to force conservative mode even if
    ;# script wasn't run conservatively originally
    if {$force_conservative} {
    set send_slow {1 .1}
    proc send {ignore arg} {
    sleep .1
    exp_send -s -- $arg
    set timeout -1
    spawn ssh -l admin -i /root/sys.dat $a uptime
    match_max 100000
    expect -exact "Enter passphrase for key '/root/sys.dat': "
    send -- "password\r"
    expect eof


    I am logging in as admin and i want to check the uptime that i have to make it for many servers.
    If i execute the program it shows the following error

    invalid command name ""
    while executing
    (file "./login" line 45)

    Please give me a solution and thanks for the support in advance

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    I don't actually know Expect, but my quick Wikipedia research tells me that the problem is probably that you are using the wrong variable syntax for $a. I don't know what the proper syntax is, but Expect is somehow reading "" as an Expect command (which obviously doesn't exist) rather than a variable declaration.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts