• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


28 Mar, 2025

Updated at 18 May, 2025

What do the double dashes in expect do?

I am trying to figure out the difference in below code

#!/usr/bin/env expect
spawn -noecho git_script.sh
expect "Are you sure you want to continue connecting (yes/no/[fingerprint])? "

send "yes\r" 
# below with dashes
send -- "yes\r" 

What is the difference? In the manpage I found:

The -- flag forces the next argument to be interpreted as a string rather than a flag. Any string can be preceded by "--" whether or not it actually looks like a flag. This provides a reliable mechanism to specify variable strings without being tripped up by those that accidentally look like flags. (All strings starting with "-" are reserved for future options.)

But I dont quite understand it.