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?
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.
argv0is a global variable, so if you're doing that in a procedure, you need to either declareglobal argv0or specify the variable in the global namespace$::argv0– glenn jackman Jun 14 '11 at 16:36man 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