• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quoteception

yhelothar

Lifer
I'm trying to embed an expect script, but the command I'm setting has some major quoteception going on with variables inside of them and I'm having difficulty on getting it all worked out.

MPJLAUNCH=/filepath.sh
nbnodes=25
expect -c '
spawn ssh username@server
expect 'assword' {send $::env(password)\r}
expect '$ '
send 'sed -i "s/-np [0-9][0-9]/-np $nbnodes/g" $MPJLAUNCH\r'
'

When I launch this, I get an error:
send sed" : no such file or directory

So it seems like it's reading " as the file path?
 
Last edited:
Having never seen the expect command until now...

I'm guessing that you want to remove the attempt at an expect -c wrapper:

Code:
MPJLAUNCH=/filepath.sh
nbnodes=25
spawn ssh mikehuan@hpc-login2.usc.edu
expect 'assword' {send $::env(password)\r}
expect '$ '
send 'sed -i "s/-np [0-9][0-9]/-np $nbnodes/g" $MPJLAUNCH\r'

At any rate, it doesn't wrap properly - it stops at the next single quote.
 
Back
Top