Reputation: 180
I'm attempting to run a shell script from TCL. I'm having a bit of trouble though as it's not working or giving me an error to troubleshoot. I'm pretty sure my issue is coming from not having "run" formatted properly. Any help is appreciated.
set run "sshpass -p 'password' ssh user@ip 'bash -s' <"
set sh "test.sh"
set cmd [list $run $sh $arg1 $arg2]
if {[catch {eval [linsert $cmd 0 "exec"]} status]} {
foreach line [split $status "\n"] {
if {[string match *text* $line]} {
//do something
}
}
}
Upvotes: 0
Views: 2197
Reputation: 180
Ended up removing the run variable and adding it directly. Works fine now.
set sh "test.sh"
set cmd [list sshpass -p 'password' ssh user@ip 'bash -s' \< $sh $arg1 $arg2]
if {[catch {eval [linsert $cmd 0 "exec"]} status]} {
foreach line [split $status "\n"] {
if {[string match *text* $line]} {
//do something
}
}
}
Upvotes: 2