expect help (multiple commands in argument)
Dear All,
I am stuck in between an expect script. Here is my code. Code:
#!/bin/bash Code:
CMD="uname -a;df -kh" Code:
-sh-3.00$ ./vik.sh |
http://rcsg-gsir.imsb-dsgi.nrc-cnrc....et/node31.html
just Code:
ssh user@host "uname -a;df -kh" |
Quote:
|
put CMD inside expect:
http://mysqlpreacher.com/wordpress/2...ash-scripting/ and http://stackoverflow.com/questions/1...-a-bash-script is examples |
Quote:
Code:
spawn ssh $USER@$HOST "$CMD" |
Quote:
Thanks for your time. I did put $CMD as "$CMD" in spawn line. Now, when I am using variable Code:
CMD="uname -a;df -kh" Code:
expect: invalid option -- a And when I remove use Code:
CMD="uname;df -kh" Code:
couldn't read file ";": no such file or directory |
Quote:
As per the examples, I tried but could not succeed. This is my new modified code :- #!/bin/bash Code:
LOGIN () Code:
expect: invalid option -- a |
Hi Gurus,
Any other ideas ? |
Just a quick look !! I cannot verify your expect but you can write another shell at "112.110.32.203" which contains there two commands and then execute this command rather than uname -a and df -kh.
I know it is not the answer to your question. But another way round solution to your problem. Another thought. if you have autoexpect installed try it using autoexpect. !! |
Quote:
Code:
VAR=$(expect -c " |
Quote:
Perfect ! This did wonders for me. Thanks a TON ! :D |
All times are GMT -5. The time now is 11:54 PM. |