expect 'missing close-brace' error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting expect 'missing close-brace' error
# 1  
Old 06-15-2010
expect 'missing close-brace' error

my expect script fails when it tries to send a password that I have that uses {}'s. Hoping I can correct that. It doesn't complain about the %, #, *, /, ? or ~ characters only the {}'s.

Code:
#!/usr/bin/expect
spawn ssh root@ca199 
expect dsa {send GW7N'%;rwqaFG92tvWG*{kK0?jz/3ReR?>pLP2#YxO+?7]!0~0z{6h%\r}

Quote:
sh-3.2$ ./99.exp
spawn ssh root@ca199
missing close-brace
while executing
"expect dsa {send GW7N'%;rwqaFG92tvWG*{kK0?jz/3ReR?>pLP2#YxO+?7]!0~0z{6h%\r}
Looking for a quick solution, off whim, I tried enclosing it in ` and " but neither worked. What can i do to send my password 'as is' without the error? I've searched but can't seem to find how to correct this. Please help. Thanks!

Last edited by phpfreak; 06-15-2010 at 11:32 PM..
# 2  
Old 06-15-2010
Quote:
Originally Posted by phpfreak
my expect script fails when it tries to send a password that I have that uses {}'s. Hoping I can correct that. It doesn't complain about the %, #, *, /, ? or ~ characters only the {}'s.

Code:
#!/usr/bin/expect
spawn ssh root@ca199 
expect dsa {send GW7N'%;rwqaFG92tvWG*{kK0?jz/3ReR?>pLP2#YxO+?7]!0~0z{6h%\r}

Looking for a quick solution, off whim, I tried enclosing it in ` and " but neither worked. What can i do to send my password 'as is' without the error? ...
I think it's complaining because the send command itself is enclosed in braces.

Try either of these variations -

Code:
#!/usr/bin/expect
spawn ssh root@ca199 
expect dsa ; send "GW7N'%;rwqaFG92tvWG*{kK0?jz/3ReR?>pLP2#YxO+?7]!0~0z{6h%\r"

Code:
#!/usr/bin/expect
spawn ssh root@ca199 
expect dsa
send "GW7N'%;rwqaFG92tvWG*{kK0?jz/3ReR?>pLP2#YxO+?7]!0~0z{6h%\r"

HTH,
tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Missing argument for option: n Error

I am trying to execute the cli.sh script in another shell script passing arguments and getting the below error. Myscript.sh #!/bin/sh /home/runAJobCli/cli.sh runAJobCli -n $Taskname -t $Tasktype I am passing the below 2 arguments and it giving error ./Myscript.sh T_SAMPLE_TEST MTT... (11 Replies)
Discussion started by: Info_Geek
11 Replies

2. Shell Programming and Scripting

[: ']' missing Error is coming

Hi guyz, i m new to UNIX (ksh) shell scripting. while running simple code i m getting error. read opt1 read opt2 if && ]; then echo "Yes" fi while running i m getting the below error. 0 YES ./ifelse.ksh: ' missing ./ifelse.ksh: 0: not found ./ifelse.ksh: 0: not found ... (4 Replies)
Discussion started by: Jonty Immortal
4 Replies

3. Shell Programming and Scripting

Expect slowing down / missing characters

Im writing an expect program to connect to cisco routers and run commands. my commands file has only two entries show version show running-config when I run the script, the first command is run without a problem. The second command isn't. The "s" is missing at the device command line,... (1 Reply)
Discussion started by: popeye
1 Replies

4. Shell Programming and Scripting

[Solved] SFTP error - Couldn't close file: Failure

I am trying to send a file from my 9000 box to a vendor using sftp and I am getting this error: Couldn't close file: Failure Here are the results of my automated script: Connected to yyy.com. sftp> pwd Remote working directory: / sftp> cd xxxxx/yyyyy_TEST/TEST sftp> put FILE FILETEST... (1 Reply)
Discussion started by: nickg
1 Replies

5. UNIX for Dummies Questions & Answers

Can I use a variable with brace expansion?

So, I was bored on the train today, and was thinking of ways to loop through elements of an array. I came up with the following simple script, but it doesn't work as brace expansion doesn't seem to work with variables. Is there something I'm missing, or does the shell just not work like this? ... (4 Replies)
Discussion started by: DeCoTwc
4 Replies

6. Programming

when parent process close, how to close the child?

can someone provide an example, where if the parent process quits for any reason, then the child process will also close? (3 Replies)
Discussion started by: omega666
3 Replies

7. Shell Programming and Scripting

Error : [: missing `]'

Hi, I am attempting to test the input value for an integer. And if the value is not an integer, the intent is to complain about it and exit. Only if I can get past the syntax error, life will be full. # test input to be a number +$'; ] && { echo "Invalid input; Enter an integer..."; exit 2; }... (7 Replies)
Discussion started by: IETF
7 Replies

8. Shell Programming and Scripting

Find closing brace "{" of a given open brace "{"

There is a file as: ....... some text timing () { capacitance : 9.0; incap : 0.8; cell_fall () { values ("8.9","7.8"); } } ........ some more text ####### Is there a way to directly find closing brace "{" of timing () block "{" ? (2 Replies)
Discussion started by: nehashine
2 Replies

9. UNIX for Dummies Questions & Answers

Variable brace expansion

I'm in the habit of using the following type of loop structure: for num in `seq $1 $2` do command doneWhile `seq $1 $2` is not exactly a huge resource hog, I would like to learn a better way. It seems that brace expansion is a good way to go: for num in {3..10}The problem, though, is... (2 Replies)
Discussion started by: treesloth
2 Replies

10. Shell Programming and Scripting

Brace expansion problem in Bash

I have a script that takes an option for server pools to run the script against. The option is given as a comma separated list (ie, -p 201,204,301). I'm using eval and brace expansion to get those pool numbers into an array. It works fine unless only 1 pool number is given. Here's the code: ... (5 Replies)
Discussion started by: mglenney
5 Replies
Login or Register to Ask a Question