<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Scripting Problem in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086686#M93008</link>
    <description>MY Script in HP-UX is:&lt;BR /&gt;&lt;BR /&gt;#! /bin/ksh&lt;BR /&gt;main ()&lt;BR /&gt;{&lt;BR /&gt;tput clear&lt;BR /&gt;echo "\t************************** WELCOME ****************************** \n"&lt;BR /&gt;echo "\t\t\t 1.top\n"&lt;BR /&gt;echo "\t\t\t 2.bdf\n"&lt;BR /&gt;echo "\t\t\t 3.syslog\n"&lt;BR /&gt;echo "\t\t\t 4.log shipment\n"&lt;BR /&gt;echo "\t\t\t x.exit\n"&lt;BR /&gt;echo "\t***************************************************************** \n"&lt;BR /&gt;echo "\t Enter your choice: \c"&lt;BR /&gt;read input&lt;BR /&gt;case $input in&lt;BR /&gt;1) /usr/bin/top -d 1 ;;&lt;BR /&gt;2) /usr/bin/bdf ;;&lt;BR /&gt;3) /usr/bin/tail -10 /var/adm/syslog/syslog.log ;;&lt;BR /&gt;4) /usr/bin/ll /earch3a/edc_sb ;;&lt;BR /&gt;*) exit 0 ;;&lt;BR /&gt;esac&lt;BR /&gt;}&lt;BR /&gt;while (true)&lt;BR /&gt;do&lt;BR /&gt;main&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The Script works fine. But upon giving exit, it exits and comes to the prompt, but what i am looking for is to get exited from the server completely. And anywhere in between the script, if i give ctrl+c, even then the prompt comes up.&lt;BR /&gt;&lt;BR /&gt;I want to avoid hapenning this. &lt;BR /&gt;&lt;BR /&gt;Kindly help!!&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!!&lt;BR /&gt;&lt;BR /&gt;Sridhar</description>
    <pubDate>Sat, 05 Jan 2008 08:32:38 GMT</pubDate>
    <dc:creator>Sridhar R</dc:creator>
    <dc:date>2008-01-05T08:32:38Z</dc:date>
    <item>
      <title>Scripting Problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086686#M93008</link>
      <description>MY Script in HP-UX is:&lt;BR /&gt;&lt;BR /&gt;#! /bin/ksh&lt;BR /&gt;main ()&lt;BR /&gt;{&lt;BR /&gt;tput clear&lt;BR /&gt;echo "\t************************** WELCOME ****************************** \n"&lt;BR /&gt;echo "\t\t\t 1.top\n"&lt;BR /&gt;echo "\t\t\t 2.bdf\n"&lt;BR /&gt;echo "\t\t\t 3.syslog\n"&lt;BR /&gt;echo "\t\t\t 4.log shipment\n"&lt;BR /&gt;echo "\t\t\t x.exit\n"&lt;BR /&gt;echo "\t***************************************************************** \n"&lt;BR /&gt;echo "\t Enter your choice: \c"&lt;BR /&gt;read input&lt;BR /&gt;case $input in&lt;BR /&gt;1) /usr/bin/top -d 1 ;;&lt;BR /&gt;2) /usr/bin/bdf ;;&lt;BR /&gt;3) /usr/bin/tail -10 /var/adm/syslog/syslog.log ;;&lt;BR /&gt;4) /usr/bin/ll /earch3a/edc_sb ;;&lt;BR /&gt;*) exit 0 ;;&lt;BR /&gt;esac&lt;BR /&gt;}&lt;BR /&gt;while (true)&lt;BR /&gt;do&lt;BR /&gt;main&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The Script works fine. But upon giving exit, it exits and comes to the prompt, but what i am looking for is to get exited from the server completely. And anywhere in between the script, if i give ctrl+c, even then the prompt comes up.&lt;BR /&gt;&lt;BR /&gt;I want to avoid hapenning this. &lt;BR /&gt;&lt;BR /&gt;Kindly help!!&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!!&lt;BR /&gt;&lt;BR /&gt;Sridhar</description>
      <pubDate>Sat, 05 Jan 2008 08:32:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086686#M93008</guid>
      <dc:creator>Sridhar R</dc:creator>
      <dc:date>2008-01-05T08:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086687#M93009</link>
      <description>If you want the script to logout of the login shell and machine, you'll need to use exec on your script:  $ exec script&lt;BR /&gt;&lt;BR /&gt;If you want to exit completely on control C, you need to add a trap:&lt;BR /&gt;trap 'echo "doing exit"; exit' 2</description>
      <pubDate>Sat, 05 Jan 2008 08:56:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086687#M93009</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-01-05T08:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086688#M93010</link>
      <description>Thanks for the reply! &lt;BR /&gt;&lt;BR /&gt;But i want to know where should i put these two lines in the script.&lt;BR /&gt;&lt;BR /&gt;Kindly let me know!!</description>
      <pubDate>Sat, 05 Jan 2008 09:44:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086688#M93010</guid>
      <dc:creator>Sridhar R</dc:creator>
      <dc:date>2008-01-05T09:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086689#M93011</link>
      <description>Hi Shridar:&lt;BR /&gt;&lt;BR /&gt;As Dennis noted, add a 'trap' to catch the 'Ctrl_C' signal.  The 'exec scriptname' would be placed in the last line of your login profile, like:&lt;BR /&gt;&lt;BR /&gt;exec /home/shridar/menu.sh&lt;BR /&gt;&lt;BR /&gt;Then, as soon as you login, your script runs.  When the script exits, you are also logged off the server.  Your script would look like the following.  Notice that I added a prompt and a read for keyboard input at the end of the 'case' execution.  You want the user to be able to see your output!&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;trap 'echo "doing exit"; exit' 2&lt;BR /&gt;main ()&lt;BR /&gt;{&lt;BR /&gt;tput clear&lt;BR /&gt;echo "\t************************** WELCOME ****************************** \n"&lt;BR /&gt;echo "\t\t\t 1.top\n"&lt;BR /&gt;echo "\t\t\t 2.bdf\n"&lt;BR /&gt;echo "\t\t\t 3.syslog\n"&lt;BR /&gt;echo "\t\t\t 4.log shipment\n"&lt;BR /&gt;echo "\t\t\t x.exit\n"&lt;BR /&gt;echo "\t***************************************************************** \n"&lt;BR /&gt;echo "\t Enter your choice: \c"&lt;BR /&gt;read input&lt;BR /&gt;case $input in&lt;BR /&gt;1) /usr/bin/top -d 1 ;;&lt;BR /&gt;2) /usr/bin/bdf ;;&lt;BR /&gt;3) /usr/bin/tail -10 /var/adm/syslog/syslog.log ;;&lt;BR /&gt;4) /usr/bin/ll /earch3a/edc_sb ;;&lt;BR /&gt;*) exit 0 ;;&lt;BR /&gt;esac&lt;BR /&gt;echo "Press RETURN to continue"&lt;BR /&gt;read REPLY&lt;BR /&gt;}&lt;BR /&gt;while (true)&lt;BR /&gt;do&lt;BR /&gt;main&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 05 Jan 2008 14:12:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086689#M93011</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-01-05T14:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086690#M93012</link>
      <description>And to clarify why the exit in a script does not logout the session, anything you run from your login shell starts a subprocess (also called a child process) and when the child finishes, control is returned back to your login shell. The exec command says in essence: replace my current shell with a shell running this script. Then when the new script finishes, the session is closed.&lt;BR /&gt; &lt;BR /&gt;If you want a certain user to always run this set of commands, you can change this user's login shell in /etc/passwd to specify the script instead of /usr/bin/sh or /usr/bin/ksh. Now the script will be the login process and when complete, will close the session. This is a common way to prevent shell access and only provide a menu for restricted users.</description>
      <pubDate>Sat, 05 Jan 2008 15:27:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086690#M93012</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2008-01-05T15:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086691#M93013</link>
      <description>Thanks very much to all the replies. Its working great now.&lt;BR /&gt;&lt;BR /&gt;Thanks once again.&lt;BR /&gt;&lt;BR /&gt;Sridhar</description>
      <pubDate>Mon, 07 Jan 2008 05:06:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086691#M93013</guid>
      <dc:creator>Sridhar R</dc:creator>
      <dc:date>2008-01-07T05:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Problem</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086692#M93014</link>
      <description>&lt;BR /&gt;Got the solution that i expected.</description>
      <pubDate>Mon, 07 Jan 2008 05:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-problem/m-p/5086692#M93014</guid>
      <dc:creator>Sridhar R</dc:creator>
      <dc:date>2008-01-07T05:14:35Z</dc:date>
    </item>
  </channel>
</rss>

