- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Help Needed for Script
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
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
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
тАО12-22-2005 04:44 PM
тАО12-22-2005 04:44 PM
I write a one script for quit the application , if i quit the db it should comeout from telnet sessions itself and also CTRL-C should not work because only quit only can quit the session
below the script i tried but if i quit its going to $ prompt and not comeout from telnet session
pls help anyone
dbcheck()
{
if [ $DB123 = "quit" ]
then
clear
exit 0
else
getdb
fi
}
getdb()
{
clear
echo "\n\n\n\n\n
Enter the db name you wish to connect to \n or quit to exit : \c"
read DB123
dbcheck
}
getdb
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 04:56 PM
тАО12-22-2005 04:56 PM
Re: Help Needed for Script
You can try two options,
#1. Try logout, it will logout from script shell.
#2. Create an alias for it, just like "./myscript.sh; exit"
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 05:01 PM
тАО12-22-2005 05:01 PM
Re: Help Needed for Script
Can you give some example how to do
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 05:02 PM
тАО12-22-2005 05:02 PM
Re: Help Needed for Script
To disable operation of ^c, you need to set the trap to ignore ^c.
trep '' 3
3 is interrupt signal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 05:09 PM
тАО12-22-2005 05:09 PM
Re: Help Needed for Script
{
if [ $DB123 = "quit" ]
then
clear
break
exit 0
else
getdb
fi
}
logout # logout is quit is entered.
getdb()
{
trap '' 3 # to ignore the ^c
clear
echo "\n\n\n\n\n
Enter the db name you wish to connect to \n or quit to exit : \c"
read DB123
dbcheck
}
getdb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 05:09 PM
тАО12-22-2005 05:09 PM
Re: Help Needed for Script
http://groups.google.com/group/comp.unix.questions/browse_thread/thread/7454d8d229e84167/09b8b71f5423e734?lnk=st&q=how+to+logout+from+a+shell+script%3F&rnum=1&hl=en#09b8b71f5423e734
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 05:23 PM
тАО12-22-2005 05:23 PM
Re: Help Needed for Script
Trap is not working pls help me if u hv example pls tell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 05:31 PM
- Tags:
- trap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 07:27 PM
тАО12-22-2005 07:27 PM
Re: Help Needed for Script
Trap is working now my script is disabled the CTRL-C but how i should comeout from current telnet session thro' script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-22-2005 07:38 PM
тАО12-22-2005 07:38 PM
Re: Help Needed for Script
You need to logout from the shell or kill it's PPID within the script. Take a look at the link which i have posted earlier on how to accomplish this.
-Arun