5

In bash, I can do something like this:

echo "The name of this script is $0"

Is there a way to do something similar in expect?

Runcible
  • 2,955
  • 3
  • 22
  • 15
  • 5
    Can't answer my own question since I don't have the rep -- but I figured it out: puts "The name of this script is $argv0" – Runcible Jun 01 '11 at 19:15
  • 3
    Note that `argv0` is a global variable, so if you're doing that in a procedure, you need to either declare `global argv0` or specify the variable in the global namespace `$::argv0` – glenn jackman Jun 14 '11 at 16:36
  • From `man expect`: argv0 is defined to be the name of the script (or binary if no scriptis used). For example, the following prints out the name of the script and the first three arguments: `send_user "$argv0 [lrange $argv 0 2]\n"` – Paweł Brodacki Sep 25 '11 at 08:22

1 Answers1

3

argv0 is a global variable that is defined to be the name of the script.

This question is answered in the comments above by @Runcible . Just adding this answer so this question shows up as answered correctly.

JamesThomasMoon
  • 633
  • 2
  • 5
  • 23
P.T.
  • 380
  • 2
  • 8