Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
3  
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 1 '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 8:22

1 Answer 1

This question was answered in the comments above. I'm just adding this so it shows up as answered correctly.

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.