- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to run multiple commands using expect?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2012 10:02 AM
06-06-2012 10:02 AM
How to run multiple commands using expect?
Hi Gurus,
I am in process of creating a script to get multiple commands o/p from some set of servers and collecting its output in a single file.
My below commands works fine..
/usr/bin/expect -c "spawn ssh uname@hostname "'head /etc/hosts'" ; expect "'password:'" ; send "usr-passwd" ; interact "
but not this one..
/usr/bin/expect -c "spawn ssh uname@hostname "'head /etc/hosts; uname -a'" ; expect "'password:'" ; send "usr-passwd" ; interact "
this is because expect splits commands due to semicolon added between them. Is there any escape character which can be used here to fix this??
Regards,
Murugan
- Tags:
- expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2012 08:49 AM
06-07-2012 08:49 AM
Re: How to run multiple commands using expect?
>a script to get multiple commands output
Any reason you don't create a script that does the multiple commands and then run expect on that script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2012 10:20 PM
06-07-2012 10:20 PM
Re: How to run multiple commands using expect?
Hello Dennis Handly,
Thank you, for your response.
My goal is to get multiple commands output using a single/simple script from different servers. Also, I would like to give the username and password in the same script itself. Password less login using ssh-key or other solutuions doesn't satisfy my requirement.