- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Simple shell script question
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
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-20-2003 05:46 AM
02-20-2003 05:46 AM
Simple shell script question
I have a simple shell script:
db2 << EOF
CONNECT TO ISDEV
BACKUP DATABASE ISDEV TO /dev/rmt/2mnb WITH 2 BUFFERS BUFFER 1024
c
EOF
Here is what is supposed to happen
1. Issue the CONNECT TO ISDEV to the db2 command. This works fine.
2. Issue the BACKUP DATABASE ISDEV TO /dev/rmt/2mnb WITH 2 BUFFERS BUFFER 1024
to the db2 command. This works fine.
At this point, the db2 command returns the statement Press (c) to continue or (q) to quit.
I am trying to pass the c to the db2 command in order to answer the question but it is not working.
Any ideas?
Thanks,
Craig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 06:03 AM
02-20-2003 06:03 AM
Re: Simple shell script question
Try this one:
db2 << EOF
CONNECT TO ISDEV
BACKUP DATABASE ISDEV TO /dev/rmt/2mnb WITH 2 BUFFERS BUFFER 1024
c
EOF
Note that I added a blank line right before the "c" line.
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 06:04 AM
02-20-2003 06:04 AM
Re: Simple shell script question
Is there any way to stop it asking for confirmation?
If not, then you could use 'expect' to program this.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 06:24 AM
02-20-2003 06:24 AM
Re: Simple shell script question
I have never used expect but the might be an idea to try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 06:28 AM
02-20-2003 06:28 AM
Re: Simple shell script question
have you tried piping the "c" character to your script, e.g.:
# echo "c" | `your_script`
The quoutes round your_script are back_quotes - try making a separate script with a content like above, although I admit it looks ugly.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 07:47 AM
02-20-2003 07:47 AM
Re: Simple shell script question
Probably you could tweak it using the attached small wrapper to detach your script from the terminal? Sometime application give up when there's no terminal. :)
Compile it, e.g. as setsid:
# cc -o setsid setsid.c
Then run your shell script from it.
# ./setsid yourscript.sh
Best regards... Dietmar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 09:40 AM
02-20-2003 09:40 AM
Re: Simple shell script question
.....
WITH 2 BUFFERS BUFFER 1024
c^M
EOF
remember: if you edit the file with vi, to put a ^M you must do it with a ^V^M
Frank.