- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- called a script within a script that requires a re...
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-08-2007 06:41 AM
02-08-2007 06:41 AM
I'm calling a script in my scipt and the script I called is asking me "Are you sure y/n". In my script since I don't have to manually intervene, I want to automatically take "Y" for my answer. How can I put "Y" on my script?
thanks,
f. halili
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2007 06:48 AM
- Tags:
- here doc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2007 06:48 AM
02-08-2007 06:48 AM
Re: called a script within a script that requires a response
/path/to/script2 << EOF
Y
EOF
Please note that the EOF MUST start at the beginning of the line, UNLESS you do '<<-' then you can TAB over, NOT SPACE, to position EOF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2007 06:49 AM
02-08-2007 06:49 AM
Re: called a script within a script that requires a response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2007 06:52 AM
02-08-2007 06:52 AM
Re: called a script within a script that requires a response
# cat script1
#!/usr/bin/sh
echo "running..."
echo "YES!" | script2
echo "done"
# cat script2
#!/usr/bin/sh
read REPLY
echo "You said ${REPLY}"
# ./script1
running...
You said YES!
done
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2007 06:52 AM
02-08-2007 06:52 AM
Re: called a script within a script that requires a response
echo "Y" | myscript.sh
Now when faced with more complicated choices (ie the questions change with varying conditions), that becomes the role of the expect utility.
http://hpux.its.tudelft.nl/hppd/hpux/Tcl/expect-5.43/
But for your simple case, reading from a file or pipe should suffice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2007 08:06 AM
02-08-2007 08:06 AM