- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- unix command inside 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
Forums
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
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
02-24-2004 04:18 AM
02-24-2004 04:18 AM
unix command inside expect
How to run unix command and store the output in a variable?
set file1 `/tmp/data +%m%d%y`
above syntax not working. Any help would be appreciated.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2004 04:24 AM
02-24-2004 04:24 AM
Re: unix command inside expect
I assume you are trying to store the date in a variable. Try this :-
# set file1=`date +%m%d%y`
# echo $file1
Regards,
Dave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2004 04:24 AM
02-24-2004 04:24 AM
Re: unix command inside expect
However, in your case I think you want
file1="/tmp/data"$(date +%m%d%y)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2004 04:29 AM
02-24-2004 04:29 AM
Re: unix command inside expect
Is he using csh?
So would it be something like :-
set file1="/tmp/data"`date +%m%d%y`
Regards,
Dave.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2004 04:32 AM
02-24-2004 04:32 AM
Re: unix command inside expect
My question was unix command inside expect script not in shell script.Your suggestion didn't work.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2004 04:45 AM
02-24-2004 04:45 AM
Re: unix command inside expect
Use it after the expect script ends - or during?
It might be easier to run your unix command and output redirect to a logfile?
Usually in expect - it is command, then response....
IE:
# remove all of the files after mgetting them
send_user "Removing Remote Files:\n"
expect "sftp>"
send -- "rm *\r"
expect "sftp>"
send -- "\r\n"
expect "sftp>"
send -- "quit\r"
# close the log file
log_file
expect eof
Rgds...Geoff