Reputation: 920
exec -- sftp [email protected] {<<
get $filename
quit}
How can i substitute $filename?
Upvotes: 1
Views: 211
Reputation: 137577
To get variable substitution, use double quotes instead of braces. Standard Tcl rule, though maybe surprising to you in this situation. (I recommend putting the <<
outside as its own argument as I think it is clearer that way.)
exec -- sftp [email protected] << "
get $filename
quit"
You can also use the subst
command. Sometimes that is clearer; it's largely equivalent (except for some very fine niceties that don't matter too much unless you're doing large templated documents).
exec -- sftp [email protected] << [subst {
get $filename
quit
}]
Upvotes: 4